[英]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.