简体   繁体   中英

Azure Active Directory get access token

I'm kinda stuck on how to get the access token from a webview login.

I have a link working but after they type in a code / password I want it to send the token back to the client device. How do i do this?

Current redirect uri is https://login.live.com/oauth20_desktop.srf .

In addition, it shows a stay signed in page - how do I disable this?

Lastly it shows another page saying let this app access your info?

Is there any way to get rid of this (getting verified?) so it closes like lunar client after finish.

• 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, ie, 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://docs.microsoft.com/en-us/azure/active-directory/develop/msal-android-single-sign-on

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM