dimanche 23 août 2015

OWIN | Get new Access Token when Access token gets expired

I have implemented OWIN authentication process in my project. Every thing works fine as I am able to get the access token, expiration time, the only issue I am facing is that I am start getting 401 error after 1 day because access token get expired. I think, I have to add a Refresh token with the login authentication process and the need to get the access token using that refresh token. Please help me in this context, unable to find any solution. Please have a look on below code what I have actually did.


public void ConfigureOAuth(IAppBuilder app)
        OAuthAuthorizationServerOptions OAuthServerOptions = new OAuthAuthorizationServerOptions()

            AllowInsecureHttp = true,
            TokenEndpointPath = new PathString("/token"),
            AccessTokenExpireTimeSpan = TimeSpan.FromDays(1),
            Provider = new SimpleAuthorizationServerProvider()

        // Token Generation

        app.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions());

Interceptor File:

var _responseError = function (rejection) {
    if (rejection.status === 401) {
    return $q.reject(rejection);

Currently I am just redirecting the user to login page but I want to get the new access token.

Aucun commentaire:

Enregistrer un commentaire