Web api owin OAuth 2.0 rolling ending

I am using OAuth 2.0 for security owin (token carrier) in my web api project. Is there any way to override the default behavior and make a sliding end of the token, and how can I get out of this authentication?

+4
source share
1 answer

If you follow the web API template for ASP.NET and OWIN using OAuth, if you make a call to the sign out function of the AccountController and pass the token of your subscriber, you will be logged out and the carrier token will no longer be active.

For OAuth, you must update the token before it expires or after it expires, or re-authenticate the user to receive a new token completely after the expiration. In fact, the validity period of the token is fixed, but by performing a periodic update, you get the same final result. Expiration with each update. All of this can be configured in OAuthAuthorizationServerOptions , which is passed to your OWIN application context in Startup.Auth .

Hope this helps.

+1
source

Source: https://habr.com/ru/post/1546441/


All Articles