You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expected behavior
The interactive authentication flow must works correctly both in Unity editor (pc) and on target platform (iOS) and return the token after the user has completed the authentication flow in a browser / web view.
Actual behavior
[Unity Editor] 🟢
When user access is requested, the authentication flow starts in the browser, then the user successfully completes the login. The procedure ends successfully and the access token is returned in the calling application to be used in subsequent API calls.
[iOS] 🔴
When user access is requested, the authentication flow starts in the Web View (SFSafariViewController), then the user successfully completes the login. The procedure ends with error:
MsalClientException: The response from the token endpoint does not contain the token_type parameter. This happens if
the identity provider (AAD, B2C, ADFS, etc.) did not include the access token type in the token response. Verify the configuration of the identity provider.
MSAL Log Summary 1) Redirect Uri was matched. Returning success from CustomWebUiHandler.
2) An authorization code was retrieved from the /authorize endpoint.
3) Exchanging the auth code for tokens.
4) SendTokenRequestAsync
MSAL Client Exception: Error Code: token_type_missing
Possible solution
I have no idea how to proceed, the log does not help, Azure side everything seems to be configured correctly.
We expect the response from AAD to have a key "token_type" which will be set to "Bearer" in this case. The server is pretty good at this, so I suspect that's happening here is an error in JSON deserialization, which uses reflection and is known to have issues on Unity.
We can't fix this in the netstandard version of the library, but we do plan to add a fix it in an upcoming NET6 version of the library, which would use the new System.Text.Json library which does not rely on reflection.
Logs and network traces
Log
Which version of MSAL.NET are you using?
MSAL 4.47.0.0
Platform
iOS - Unity - .NET Standard 2.1
MSAL.CoreCLR Mono Unity IL2CPP (May 15 2022 12:12:00) Unix 20.6.0.0
What authentication flow has the issue?
Is this a new or existing app?
App in development phase
Repro
PublicClientApplication creation
AcquireToken flow
Expected behavior
The interactive authentication flow must works correctly both in Unity editor (pc) and on target platform (iOS) and return the token after the user has completed the authentication flow in a browser / web view.
Actual behavior
[Unity Editor] 🟢
When user access is requested, the authentication flow starts in the browser, then the user successfully completes the login. The procedure ends successfully and the access token is returned in the calling application to be used in subsequent API calls.
[iOS] 🔴
When user access is requested, the authentication flow starts in the Web View (SFSafariViewController), then the user successfully completes the login. The procedure ends with error:
MsalClientException: The response from the token endpoint does not contain the token_type parameter. This happens if
the identity provider (AAD, B2C, ADFS, etc.) did not include the access token type in the token response. Verify the configuration of the identity provider.
MSAL Log Summary
1) Redirect Uri was matched. Returning success from CustomWebUiHandler.
2) An authorization code was retrieved from the /authorize endpoint.
3) Exchanging the auth code for tokens.
4) SendTokenRequestAsync
MSAL Client Exception: Error Code: token_type_missing
Possible solution
I have no idea how to proceed, the log does not help, Azure side everything seems to be configured correctly.
Additional context / logs / screenshots / links to code
iCustomWebUi Interface
MSAL Error Handling
The text was updated successfully, but these errors were encountered: