简体   繁体   English

Azure Active Directory 获取访问令牌

[英]Azure Active Directory get access token

I'm kinda stuck on how to get the access token from a webview login.我有点坚持如何从 webview 登录中获取访问令牌。

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 .当前重定向 uri 是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. • 我建议您参考下面的社区线程,通过 Android 上的 webview 接收身份验证令牌。 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 .在此代码中,您添加了一个“WebAppInterface” ,其中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);'在那,您必须将'WebAppInterface'注册为'webView.addJavascriptInterface(WebAppInterface(this),“Android”)',基于此Web前端可以调用function,如'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? 如何在 Android 中使用 WebView 获取身份验证令牌?

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 .此外,它取决于 MSAL 使用的应用程序类型,用于在 Android 上运行的 webview 应用程序以实现 SSO,即通过系统浏览器或通过代理应用程序 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: -因此,要进行与上述相同的设置,请确保将以下行放在传递给 MSAL 的应用程序配置 JSON 中:-

"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 .因此, 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: -请参阅以下链接以获得更多说明,因为它描述了在 webview 上使用 SSO 和通过 MSAL 身份验证获取访问令牌所需的步骤:-

https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-android-single-sign-on https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-android-single-sign-on

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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