[英]Azure Active Directory get access token
我有点坚持如何从 webview 登录中获取访问令牌。
我有一个有效的链接,但是在他们输入代码/密码后,我希望它将令牌发送回客户端设备。 我该怎么做呢?
当前重定向 uri 是https://login.live.com/oauth20_desktop.srf
。
此外,它显示了一个保持登录页面 - 我如何禁用它?
最后它显示另一个页面说让这个应用程序访问您的信息?
有什么办法可以摆脱这个(得到验证?)所以它在完成后像月球客户端一样关闭。
• 我建议您参考下面的社区线程,通过 Android 上的 webview 接收身份验证令牌。 在此代码中,您添加了一个“WebAppInterface” ,其中android function should accept the token as a parameter after the user has successfully logged in and got his token
。 在那,您必须将'WebAppInterface'注册为'webView.addJavascriptInterface(WebAppInterface(this),“Android”)',基于此Web前端可以调用function,如'Android.consumeToken(token);'
有关更多详细信息,请参阅以下社区线程以供参考:-
如何在 Android 中使用 WebView 获取身份验证令牌?
此外,它取决于 MSAL 使用的应用程序类型,用于在 Android 上运行的 webview 应用程序以实现 SSO,即通过系统浏览器或通过代理应用程序。 因此,要进行与上述相同的设置,请确保将以下行放在传递给 MSAL 的应用程序配置 JSON 中:-
"authorization_user_agent" : "WEBVIEW"
因此, 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
。 请参阅以下链接以获得更多说明,因为它描述了在 webview 上使用 SSO 和通过 MSAL 身份验证获取访问令牌所需的步骤:-
https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-android-single-sign-on
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.