From a912a941306c40082cd5d234a7c80ae5e84985bf Mon Sep 17 00:00:00 2001 From: Eric Date: Wed, 22 Jul 2020 16:22:49 -0700 Subject: [PATCH] Fix Update authContext #33 --- Sources/iOS/Auth+iOS.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sources/iOS/Auth+iOS.swift b/Sources/iOS/Auth+iOS.swift index 26ad7c1a..29c99e4b 100644 --- a/Sources/iOS/Auth+iOS.swift +++ b/Sources/iOS/Auth+iOS.swift @@ -20,7 +20,9 @@ extension Auth { - parameter callback: The callback that is called when authorization completes or fails */ func authorize(with oauth: OAuth2, properties: SMARTAuthProperties, callback: @escaping ((OAuth2JSON?, OAuth2Error?) -> Void)) { - authContext = UIApplication.shared.keyWindow?.rootViewController + + let rootViewController = UIApplication.shared.keyWindow?.rootViewController + authContext = rootViewController?.presentedViewController ?? rootViewController oauth.authConfig.authorizeContext = authContext oauth.authConfig.authorizeEmbedded = properties.embedded