angular-auth-oidc-client: Bug: id token is erased when the server does not send a new idtoken on refresh
What Version of the library are you using? 13.1.0
Question I am trying to get refresh process working with a server that give no id token with the refresh answer:
{access_token: "ZEPGAiCD01MSG5qleO9gQzjD46c9D9", expires_in: 60, token_type: "Bearer",…}
access_token: "ZEPGAiCD01MSG5qleO9gQzjD46c9D9"
expires_in: 60
refresh_token: "hc3Crg96ehnOblKUImHAeGRgamPvf5"
scope: "openid read write"
token_type: "Bearer"
As explained in the documentation, I set the disableRefreshIdTokenAuthTimeValidation option to false and I manually call
this._oidcSecurityService.forceRefreshSession().subscribe((result:any) => {
if (!result || result == null) {
console.error('Access token refresh process failed -> Logoff requested !');
...
}
});
I always get an error even if I can see in the log:

Note that access token expiration is set to 60s (for test) and id token expiration to 10s in the server.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 40 (10 by maintainers)
I have also encountered this issue, here is the culprit: https://github.com/damienbod/angular-auth-oidc-client/blob/9fc89c8a6ce8af4a2abd528c484326a6f0fa5f64/projects/angular-auth-oidc-client/src/lib/flows/callback-handling/history-jwt-keys-callback-handler.service.ts#L34
When
id_tokenis missing in refresh response, existingid_tokenwill be discarded. @damienbod can this be patched by preserving currentid_token, or will it break something else?As a workaround without modifying package code I have patched
id_tokenon save if it suddenly disappears, something like this:and then provide in app module
Do you need help with the patch?
@damienbod I can give you a clientID and a test user in our dev Microfocus access manager system if you would like to test it that way.
Would the title “id token is erased when the server does not send a new idtoken on refresh” be a better fit?
I sent it to your email address. Let me know if you need anything else.
We are currently working on this. This is also connected to #1552 which we want to solve as well. https://github.com/damienbod/angular-auth-oidc-client/pull/1571 (is still WIP)
I solved it with this interceptor 😄
as the id_token is not needed in my case anyway I can live with the access_token there as a placeholder.
@damienbod I sent you an email with the details. Let me know if you don’t get that or have questions. I forgot to add the scopes to the email, but you can use “openid profile email roles”.
Micro Focus Access Manager is apparently another name for it? Micro Focus owns NetIQ. If we are incorrect on Access Manager being another alias, please send correction.
Another specific example is NetIQ: https://www.netiq.com/documentation/access-manager-45-developer-documentation/oauth-application-developer-guide/data/managing-tokens.html
@agardiol This should work, I will test this again , doing a new release now
Greetings Damien