在Web视图中重用MSAL中的访问令牌 [英] Reuse access token from MSAL in web view

查看:52
本文介绍了在Web视图中重用MSAL中的访问令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,在我的iOS应用中,我正在通过 MSAL iOS SDK ,并且工作正常.在应用程序的某个位置,我还需要显示一个网站(通过UIWebView打开),该网站也需要相同的Azure AD身份验证.由于我已经通过SDK进行了身份验证并且具有访问令牌,因此有什么方法可以绕过Web视图中的身份验证过程吗?

In my iOS app I'm currently authenticating through the MSAL iOS SDK and it's working fine. Somewhere in the app I'm also required to show a website (opened via UIWebView) that also requires the same Azure AD authentication. Since I'm already authenticated through the SDK and have an access token, is there any way to bypass authentication process in the web view?

推荐答案

您可以使用以下方法之一进行Cookie共享:

You can use one of the following for cookie sharing:

1.MSAL中的ASWebAuthenticationSession + Safari浏览器中的打开URL

MSAL

var webViewParamaters : MSALWebviewParameters
webViewParamaters.webviewType = .authenticationSession

WEB

UIApplication.shared.open(URL(string: "your URL")!)

2.MSAL中的SFSafariViewController + SFSafariViewController中的打开URL

MSAL

 var webViewParamaters : MSALWebviewParameters
 webViewParamaters.webviewType = .safariViewController

WEB

 SFSafariViewController(url: URL(string: "your URL")!)

注意:MSAL中的WKWebView和打开URL的WKWebView将不起作用.

NOTE: WKWebView in MSAL and WKWebView to open URL will not work.

这篇关于在Web视图中重用MSAL中的访问令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆