[英]How to go from bearer token to entity id?
Likely a noob question which is answered best by pointing to something else than the direct answer, BUT: 可能有一个菜鸟问题,通过指向除直接答案(BUT)以外的其他内容,可以最好地解决这个问题:
I have setup a web api with identity authentication. 我已经设置了带有身份验证的Web API。 When someone logs in they login with email/password by calling /token
, which gives them the bearer token they can use. 当某人登录时,他们通过调用/token
使用电子邮件/密码登录,这为他们提供了可以使用的承载令牌。
However, what is the best practice to get company settings? 但是,获得公司设置的最佳实践是什么? Is that calling an /customer?email=email
? 那是打/customer?email=email
吗? I guess my question really is: How do you go from token to customerid for instance? 我想我的问题确实是:例如,您如何从令牌变成客户ID?
Since you are already creating a bearer token, you can put anything you want or need inside the token as claims. 由于您已经在创建不记名令牌,因此可以将所需的任何内容放入令牌中作为声明。
If the company is not related to your account, then the beginning of your question (about the /token endpoint) is irrelevant, 如果公司与您的帐户无关,则问题的开头(关于/ token端点)是不相关的,
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.