oyvindhauge
oyvindhauge

Reputation: 3693

Reuse access token from MSAL in web view

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?

Upvotes: 2

Views: 1995

Answers (1)

Deepak
Deepak

Reputation: 734

You can use one of the following for cookie sharing:

1. ASWebAuthenticationSession in MSAL + open URL in Safari browser

MSAL

var webViewParamaters : MSALWebviewParameters
webViewParamaters.webviewType = .authenticationSession

WEB

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

2. SFSafariViewController in MSAL + open URL in SFSafariViewController

MSAL

 var webViewParamaters : MSALWebviewParameters
 webViewParamaters.webviewType = .safariViewController

WEB

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

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

Upvotes: 2

Related Questions