We are trying to set up Identity Server 3 in the right way. We got authentication working fine and we manage to retrieve the refresh token.
The client application is using Angular.
Now when the acces_token expires any calls to the rest api fails (we managed to get it to return 401) but we are wondering how to re-authenticate the user.
In our tests, any api call made from Javascript is failing (401) but as soon as the page is refreshed the whole mechanism is kicking in. We do see that we are redirected to the identity server but it does not show up the login page, we are sent back to the client application with new tokens apparently.
What I would like to do is to refresh the access token without having to force the user to refresh the page.
What I'm not sure though is whose responsibility is it? Is that the client application (website) or the angular application? In other word, should the application handle this transparently for Angular or should angular do something when it receives a 401, in which case, I'm not too sure how the information will flow back to the web app.
Any clue?
Additional Information: We are using OpenId Connect
app.UseOpenIdConnectAuthentication()
only for the first type, and for the second... don't know but I'm trying to understand – Manchineelapp.UseOpenIdConnectAuthentication
for MVC views andapp.UseIdentityServerBearerTokenAuthentication
(or another bearer) for API. Meanwhile my workaround is extending Tokens live in Client configurations on Identity server ---AccessTokenLifetime = 3600 * 12, // extend from default 3600 sec / 1 hour to 12 hours
---IdentityTokenLifetime = 300 * 20 * 12, // extend from default 300 sec / 5 min to 12 hours
– Manchineelaccess_token
,id_token
and so on. But how to use them to actually refresh? – Manchineel