-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Web Browser Dismissing Automatically When App Goes to Background During Login (MSAL) #2381
Comments
@vinaykumar0339 we can't replicate the issue with our test app. Can you provide MSAL logs for your issue? Are you sure the view controller is not deallocated before the callback is called? |
@ameyapat Thanks for the update. I found the root cause. - (void)applicationWillEnterForeground:(UIApplication *)application
{
// This should be omitted if your application presents a lock screen
// in -applicationDidEnterBackground:
[self.window.rootViewController dismissViewControllerAnimated:NO completion:NULL];
} One query. Can we open the browser like a normal push screen instead of a presenter Modal sheet? What ever the viewController i given to MSALWebviewParameters it always showing as a sheet. is there any way to open it as normal view? My Application was Built with react native. @objc(login:reject:)
func login(resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
guard let msalApplication = msalApplication else {
// INFO: not required to show in ui. this scenario will not happen just fallback code
reject(MSAL_INITIALIZE_MSAL_APPLICATION_ERROR, "Please Initialize Application Before loginging", nil)
return
}
DispatchQueue.main.async { [weak self] in
guard let presentedViewController = RCTPresentedViewController(), let strongSelf = self else {
// INFO: not required to show in ui. this scenario will not happen just fallback code
reject(self?.MSAL_RCT_PRESENTED_VIEW_CONTROLLER_ERROR, "RCTPresentedViewController Not Found", nil)
return
}
let webParameters = MSALWebviewParameters(authPresentationViewController: presentedViewController)
let interactiveParameters = MSALInteractiveTokenParameters(scopes: strongSelf.scopes, webviewParameters: webParameters)
interactiveParameters.promptType = .selectAccount
interactiveParameters.extraQueryParameters = strongSelf.queryParams
msalApplication.acquireToken(with: interactiveParameters) { result, error in
guard let authResult = result, error == nil else {
let nsError = error! as NSError
reject("\(nsError.code)", "SomeThingWentWrong".localized(), nsError)
return
}
strongSelf.handleAcquireToken(with: authResult, resolve: resolve)
}
}
} |
@vinaykumar0339 You can set the webview type in MSALWebViewParameters. |
reference.video.mov
The text was updated successfully, but these errors were encountered: