Is it possible to use MSAL.js to get refresh token?

Viewed 18597

I want to integrate with Miscrosoft Outlook. I am able to login with MSAL.js and get an access token, but I am not able to get a refresh token. Is there a way to do it?

3 Answers

I couldn't find any answer in the MSAL.js documentation, however this source code comment suggests you can renew a token manually by passing only the clientId as your scope to acquireTokenSilent.

To renew idToken, please pass clientId as the only scope in the Authentication Parameters

I use msal v1.4.0

I remove 2 keys in storage (see picture) then call acquireTokenSilent again to get new access token. enter image description here Code to remove those 2 keys:

const keys = Object.keys(sessionStorage).filter(x => x.indexOf('authority') > 0)
keys.forEach(x => sessionStorage.removeItem(x))
Related