Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to handle oidc silent renew error

I have a setup with redux-oidc authenticating against an identity server. I can log in, and I can see that silenRenew works as expected when the token expires.

There is one problem though. If I open my site and let the computer go to sleep, when I get back after the expiration period, silent renew has failed with this error:

Frame window timed out

It does not try again once i wake up the computer. Not even when I reload the page.

Is this the expected behavior?

If so, what is the correct way of handling this so the site is not left dead?

If not, does anyone have any idea what I might be doing wrong?

like image 628
Sune Avatar asked Nov 29 '25 07:11

Sune


1 Answers

I had faced similar issue , so i did a work-around which looks ugly but still works fine for me, look for comments in the code

 this.userManager = new Oidc.UserManager(oidcSettings);

            this.userManager.events.addAccessTokenExpiring(() =>
            {
                this.userManager.signinSilent({scope: oidcSettings.scope, response_type: oidcSettings.response_type})
                    .then((user: Oidc.User) =>
                    {
                        this.handleUser(user);
                    })
                    .catch((error: Error) =>
                    {
                        // Currently as a dirty work around (looks like problem with gluu server. Need to test with other IDP's as well)
                        // in order to get the new issued token I just calling getUser() straight after signinSilent().then() promise failing with frame time out
                        // https://github.com/IdentityModel/oidc-client-js/issues/362
                        this.userManager.getUser()
                            .then((user: Oidc.User) =>
                            {
                                this.handleUser(user);
                            });
                    });
            });
like image 80
Sohan Avatar answered Dec 01 '25 23:12

Sohan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!