• I would suggest you to please refer to the below community thread for receiving an authentication token through webview on Android. In this code, you add a ‘WebAppInterface’ in which the android function should accept the token as a parameter after the user has successfully logged in and got his token
. In that, you must register the ‘WebAppInterface’ as ‘webView.addJavascriptInterface(WebAppInterface(this), "Android")’ based on which the Web frontend can invoke the function like ‘Android.consumeToken(token);’
For more details, kindly refer the below community thread for reference: -
How do you obtain a Authentication token using WebView in Android?
Also, it depends on the type of applications used by MSAL for your webview application running on Android to achieve SSO, i.e., through a system browser or through a broker application. Therefore, for setting up the same as stated above, ensure that you are putting the below line in the app configuration JSON that is passed to MSAL: -
"authorization_user_agent" : "WEBVIEW"
Thus, when using the in-app WebView, the user signs in directly to the app where the tokens are kept stored in the application itself and still SSO can work effectively
. Kindly refer to the below link for more clarification as it describes the required steps to be followed for using SSO and getting an access token through MSAL authentication on webview: -
https://learn.microsoft.com/en-us/azure/active-directory/develop/msal-android-single-sign-on