I am trying to implement Azure AD B2C authentication in my application using MSAL.
I am requesting the following scopes:
openidoffline_access
I only need the ID token for authentication purposes and do not require an access_token.
However, during authentication, I receive the following exception:
com.microsoft.identity.client.exception.MsalClientException: Missing required tokens of type: access_token
From my understanding, openid should be sufficient to return an id_token. Why is MSAL requiring an access_token even though I don’t need one?
Is it mandatory to request an API scope in Azure AD B2C, or is there a way to authenticate using only id_token without triggering this exception?
Any clarification or guidance would be appreciated.
com.microsoft.identity.client:msal
val parameters = AcquireTokenParameters.Builder()
.startAuthorizationFromActivity(activity)
.fromAuthority(authority)
.withScopes(scopes)
.withPrompt(Prompt.LOGIN)
.withAuthorizationQueryStringParameters(queryParms)
.withCallback(object : AuthenticationCallback {
override fun onCancel() {
}
override fun onSuccess(authenticationResult: IAuthenticationResult?) {
}
override fun onError(exception: MsalException?) {
}
})
.build()
client.acquireToken(parameters)