Angular-auth-oidc-client: No Event on silent renew failure

Created on 9 Jan 2021  路  4Comments  路  Source: damienbod/angular-auth-oidc-client

Hi Damien,

I had a question, I am using Code Flow with PKCE with silent renew in an Iframe. Our Auth server is having a 4 hour session and our token has 1 hour lifespan. Hence, our silent renew works fine for this duration. Once the session on server is expired, the call to silent renew fails with an error code. I am not able to get any event for this call failure. When enabling the logs, I see that silent renew is setup and the event is fired for refresh. But as that call has failed. the silent renew just logs as finished and the tokens are not renewed. Would you suggest how I can handle this scenario?

Most helpful comment

Thanks @damienbod and @Explez, yes this does solve my problem. We can close this. Thanks once again

All 4 comments

Hi @mustafakachwala

When the server session resets, you must login again. The silent renew fails which is good. The IsAuthorized obserable is triggered and set to false. Could you react to this event?

Greetings Damien

@damienbod thanks for your response.

I went through the code and what I think could be a problem is that once the url for silent renew is sent, the auth lib expects a return url with either the code or error as a param in the URL. In my case, there is no return, because the call sent to silent renew fails. The silent renew finishes because it has sent the request.

In this image, the API call which is logged is actually failed with error code 401
image
But the logs just print that silent renew was complete and periodic check completed.

I will check with our auth team to see if they can send us a 200 even if silent renew fails along with an error in the return url.

But on the lib side, should we have something like a timeout to check for the return url after silent renew is triggered. If we do not receive a return after say x seconds, we just fail and send an event to required subscribers.

@mustafakachwala Does the PR from @Expelz help you solve you problem? If so we can close this.

Greetings Damien

Thanks @damienbod and @Explez, yes this does solve my problem. We can close this. Thanks once again

Was this page helpful?
0 / 5 - 0 ratings