how to get refresh token in msal-browser Azure AD B2C login?

73 Views Asked by At

we have used msal-browser for Azure AD B2C login in the react application with vite & RTK. We want to refresh the token once the main access token expires.

But inside the react application, we couldn't receive a refresh token by calling any method of @azure/msal-browser.

By calling the acquireTokenSilent method, we got an access token but didn't receive a refresh token.

We want a refresh token inside our react application code, which we can able to see in the API response. But as mentioned, this API is called by @azure/msal-browser internally and we didn't get a refresh token on the react code side.

Reference API response screenshot

Implemented Code for acquiring the silent token

if (event.eventType === EventType.LOGIN_SUCCESS || event.eventType === EventType.ACQUIRE_TOKEN_SUCCESS) {
  if (event?.payload) {
    if (event?.payload?.idToken) {
      instance
        .acquireTokenSilent({
          scopes: [AuthConfig.Policy],
          account: currentAccount
        })
        .then(async (response) => {
          // Application level logic here
        })
    }
  }
}

Any help would be appreciated.

Thanks

0

There are 0 best solutions below