0
votes

We currently have built and asp.net mvc 5 application using Identity Server 3 to handle authentication and authorization to an Web Api, using Implicit Flow. All is working well until we started adding some angular calls to the Api. The MVC startup class handles the retrieval of the token, to get it to work with angular for now we wrote out the token into a javascript variable which angular picks up and sends in it's header to all Api calls.

There are times though where by the time the user clicks a button to invoke the angular call the token has expired. Is there a way to get another token in angular before each call, possibly check if expired then get a new one? If so possibly without a page refresh as we don't want to lose the data the user is trying to submit while getting a new token. Would this possibly lead to the application using a different token for angular and mvc side? as we are not getting rid of the mvc side just yet.

1
I would suggest checking how refresh tokens work. Check online for some demo implementation. I have tried out this one. bitoftech.net/2014/07/16/… - Igor Dimchevski

1 Answers

1
votes

Send the token to Access token validation endpoint.

Assuming you haven't disabled this endpoint, you can invoke it

POST /connect/accesstokenvalidation

token=<token>