简体   繁体   English

我应该将来自OAuth2的访问令牌存储在MVC应用程序中的什么位置?

[英]Where should I store the access token from OAuth2 in a MVC application?

I have OAuth2 Authorization Layer and Service layer as part of my MVC application. 我的MVC应用程序包含OAuth2授权层和服务层。 The Access Token obtained from OAuth2 should be accessible to Service layer as medium to communicate to APIs. 从OAuth2获得的访问令牌应该可以作为与API进行通信的媒介而被服务层访问。 I was considering storing them to Session at class level, so, is this the right method or can I store them to some custom storage ? 我当时正在考虑将它们存储在类级别的Session中,所以,这是正确的方法还是可以将它们存储到某些自定义存储中?

您可以将其添加为索偿

manager.AddClaim(userId, new Claim("AccessToken", AccessToken));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM