I am integrating the MSAL 2.2.1 into the android app.
- I have registered the app in the Azure b2c portal.
- generated the signatures and added them to the Azure b2c portal.
- got the login page upon trying to acquire the token.
- Upon successful login, MSAL redirecting to our app. But not onto the onSuccess but onto the onError with the following stack trace.
onError:Missing required tokens of type: {0}
2021-10-05 03:16:21.310 9573-9573/com.test.msal W/System.err: com.microsoft.identity.client.exception.MsalClientException: Missing required tokens of type: {0}
2021-10-05 03:16:21.310 9573-9573/com.test.msal W/System.err: at com.microsoft.identity.client.internal.controllers.MsalExceptionAdapter.msalExceptionFromBaseException(MsalExceptionAdapter.java:51)
2021-10-05 03:16:21.310 9573-9573/com.test.msal W/System.err: at com.microsoft.identity.client.PublicClientApplication$18.onError(PublicClientApplication.java:1903)
2021-10-05 03:16:21.310 9573-9573/com.test.msal W/System.err: at com.microsoft.identity.client.PublicClientApplication$18.onError(PublicClientApplication.java:1894)
2021-10-05 03:16:21.311 9573-9573/com.test.msal W/System.err: at com.microsoft.identity.common.internal.controllers.CommandDispatcher.commandCallbackOnError(CommandDispatcher.java:447)
2021-10-05 03:16:21.311 9573-9573/com.test.msal W/System.err: at com.microsoft.identity.common.internal.controllers.CommandDispatcher.access$800(CommandDispatcher.java:82)
2021-10-05 03:16:21.311 9573-9573/com.test.msal W/System.err: at com.microsoft.identity.common.internal.controllers.CommandDispatcher$3.run(CommandDispatcher.java:429)
2021-10-05 03:16:21.311 9573-9573/com.test.msal W/System.err: at android.os.Handler.handleCallback(Handler.java:883)
2021-10-05 03:16:21.311 9573-9573/com.test.msal W/System.err: at android.os.Handler.dispatchMessage(Handler.java:100)
2021-10-05 03:16:21.311 9573-9573/com.test.msal W/System.err: at android.os.Looper.loop(Looper.java:214)
2021-10-05 03:16:21.311 9573-9573/com.test.msal W/System.err: at android.app.ActivityThread.main(ActivityThread.java:7697)
2021-10-05 03:16:21.311 9573-9573/com.test.msal W/System.err: at java.lang.reflect.Method.invoke(Native Method)
2021-10-05 03:16:21.311 9573-9573/com.test.msal W/System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:516)
2021-10-05 03:16:21.311 9573-9573/com.test.msal W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
2021-10-05 03:16:21.311 9573-9573/com.test.msal W/System.err: Caused by: com.microsoft.identity.common.exception.ClientException: Missing required tokens of type: {0}
2021-10-05 03:16:21.311 9573-9573/com.test.msal W/System.err: at com.microsoft.identity.common.internal.providers.microsoft.microsoftsts.MicrosoftStsOAuth2Strategy.validateTokensAreInResponse(MicrosoftStsOAuth2Strategy.java:638)
2021-10-05 03:16:21.311 9573-9573/com.test.msal W/System.err: at com.microsoft.identity.common.internal.providers.microsoft.microsoftsts.MicrosoftStsOAuth2Strategy.validateTokenResponse(MicrosoftStsOAuth2Strategy.java:577)
2021-10-05 03:16:21.311 9573-9573/com.test.msal W/System.err: at com.microsoft.identity.common.internal.providers.microsoft.microsoftsts.MicrosoftStsOAuth2Strategy.validateTokenResponse(MicrosoftStsOAuth2Strategy.java:87)
2021-10-05 03:16:21.311 9573-9573/com.test.msal W/System.err: at com.microsoft.identity.common.internal.providers.oauth2.OAuth2Strategy.validateTokenResponse(OAuth2Strategy.java:174)
2021-10-05 03:16:21.311 9573-9573/com.test.msal W/System.err: at com.microsoft.identity.common.internal.providers.oauth2.OAuth2Strategy.requestToken(OAuth2Strategy.java:166)
2021-10-05 03:16:21.311 9573-9573/com.test.msal W/System.err: at com.microsoft.identity.common.internal.controllers.BaseController.performTokenRequest(BaseController.java:294)
2021-10-05 03:16:21.311 9573-9573/com.test.msal W/System.err: at com.microsoft.identity.common.internal.controllers.LocalMSALController.acquireToken(LocalMSALController.java:170)
2021-10-05 03:16:21.311 9573-9573/com.test.msal W/System.err: at com.microsoft.identity.common.internal.commands.InteractiveTokenCommand.execute(InteractiveTokenCommand.java:67)
2021-10-05 03:16:21.311 9573-9573/com.test.msal W/System.err: at com.microsoft.identity.common.internal.commands.InteractiveTokenCommand.execute(InteractiveTokenCommand.java:39)
2021-10-05 03:16:21.311 9573-9573/com.test.msal W/System.err: at com.microsoft.identity.common.internal.controllers.CommandDispatcher.executeCommand(CommandDispatcher.java:381)
2021-10-05 03:16:21.311 9573-9573/com.test.msal W/System.err: at com.microsoft.identity.common.internal.controllers.CommandDispatcher.access$000(CommandDispatcher.java:82)
2021-10-05 03:16:21.311 9573-9573/com.test.msal W/System.err: at com.microsoft.identity.common.internal.controllers.CommandDispatcher$4.run(CommandDispatcher.java:584)
And my request code looks like below:
application.acquireToken(requireActivity(),arrayOf("openid", "offline_access"),object : AuthenticationCallback {
And I have these permissions granted in the Azure b2c portal.
But still unable to get the token. Can someone help in fixing this ? Thanks in advance.