-
Notifications
You must be signed in to change notification settings - Fork 19
acquireTokenSilentAsync giving error on MSAL Exception Azure AD B2C during Access Token Expiry #28
Description
Before making any server call I am calling acquireTokenSilentAsync method to make sure the existing access token is not expired and also to get new token in case of its expiry. The method is returning same token in its call back response AuthenticationResult as long as it is not in expired.
But the problem here is, once the token got expired I am not receiving a new token. Instead receiving an exception saying
java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
i'm using this code :
mSingleAccountApp.acquireTokenSilentAsync(getScopes( ), mAccount.getAuthority(), getAuthSilentCallback( ));
Any help would be appreciated. Thank you.
E/MicrosoftStsOAuth2Configuration:getOpenIdWellKnownConfig: [2020-09-15 11:45:46 - {"thread_id":"185730","correlation_id":"7ee351ef-a1dc-4d13-a43e-6a66aba7e425"}] OpenId Provider Configuration metadata failed to load with status: 404 Android 29
com.microsoft.identity.common.exception.ServiceException: OpenId Provider Configuration metadata failed to load with status: 404
at com.microsoft.identity.common.internal.providers.oauth2.OpenIdProviderConfigurationClient.loadOpenIdProviderConfiguration(OpenIdProviderConfigurationClient.java:147)
at com.microsoft.identity.common.internal.providers.microsoft.microsoftsts.MicrosoftStsOAuth2Configuration.getOpenIdWellKnownConfig(MicrosoftStsOAuth2Configuration.java:156)
at com.microsoft.identity.common.internal.providers.microsoft.microsoftsts.MicrosoftStsOAuth2Configuration.getOpenIdWellKnownConfigForAuthority(MicrosoftStsOAuth2Configuration.java:132)
at com.microsoft.identity.common.internal.providers.microsoft.microsoftsts.MicrosoftStsOAuth2Configuration.getTokenEndpoint(MicrosoftStsOAuth2Configuration.java:68)
at com.microsoft.identity.common.internal.providers.microsoft.microsoftsts.MicrosoftStsOAuth2Strategy.(MicrosoftStsOAuth2Strategy.java:112)
at com.microsoft.identity.common.internal.authorities.AzureActiveDirectoryB2CAuthority.createOAuth2Strategy(AzureActiveDirectoryB2CAuthority.java:91)
at com.microsoft.identity.client.internal.controllers.LocalMSALController.acquireTokenSilent(LocalMSALController.java:282)
at com.microsoft.identity.common.internal.commands.SilentTokenCommand.execute(SilentTokenCommand.java:75)
at com.microsoft.identity.common.internal.commands.SilentTokenCommand.execute(SilentTokenCommand.java:41)
at com.microsoft.identity.common.internal.controllers.CommandDispatcher.executeCommand(CommandDispatcher.java:170)
at com.microsoft.identity.common.internal.controllers.CommandDispatcher.access$200(CommandDispatcher.java:66)
at com.microsoft.identity.common.internal.controllers.CommandDispatcher$2.run(CommandDispatcher.java:127)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
2020-09-15 17:15:46.444 2530-2699/com.ust.fcs.wiwo W/LocalMSALController:acquireTokenSilent: [2020-09-15 11:45:46 - {"thread_id":"185730","correlation_id":"7ee351ef-a1dc-4d13-a43e-6a66aba7e425"}] Access token is expired. Removing from cache... Android 29
2020-09-15 17:15:47.651 2530-2530/com.ust.fcs.wiwo D/Exception: messagecom.microsoft.identity.client.exception.MsalClientException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $