react-adal icon indicating copy to clipboard operation
react-adal copied to clipboard

how to access the refresh token if my app idle for about half an hour without refreshing the page.

Open erwin-d-austria opened this issue 5 years ago • 5 comments

I have an app that validates token from backend. If my app idle for about an hour, the validation trigger for valid token.. Is there a way to get a refresh token without refreshing the page?

erwin-d-austria avatar Jan 06 '20 07:01 erwin-d-austria

Bump!

qt-pixels avatar Mar 25 '20 08:03 qt-pixels

any updates on this issue ? pl share

jka1010 avatar May 26 '20 08:05 jka1010

If you find any solution , please comment here @erwin-d-austria

saikumarkunchaa avatar Jun 25 '20 07:06 saikumarkunchaa

There's a method named adalGetToken in the library. You can call it to renew the token from anywhere. @jka1010 @saikumarkunchaa @qt-pixels @erwin-d-austria

aamay001 avatar Aug 05 '20 18:08 aamay001

For anyone in this same situation, as @aamay001 mentioned there's an undocumented method adalGetToken(AuthenticationContext, resource) you can use to silently refresh the token. Given that the library doesn't refresh the token automatically, and needs to be manually handled.

However if the user is not logged in anymore or the token can't be refreshed, it will throw an error with a msg: 'login_required', in that case you need to either refresh the page or call the AuthenticationContext.login() to redirect the user to the login page.

Leaving this here for the next person 👍

foxxor avatar Oct 22 '20 12:10 foxxor