Describe the bug
On your Readme page you state that Universal Links are supported. Unfortunately the SFSafariViewController that gets presented using the OIDAuthState.authState(byPresenting: request, presenting: presentingVC) does not close once the redirect URL is reached.
However, copying the URL from the SFSafariViewController and pasting it into Safari manually triggers the App redirect and continues the auth flow in the func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool method resulting in getting a valid authToken, refreshToken, idToken.
My redirect URL looks like this: https://appSubdomain.domain.com/ios/oauth2/callback
I have added applinks:appSubdomain.domain.com under the Associated Domains group in the Target Capabilities. As mentioned before, manually entering https://appSubdomain.domain.com/ios/ in Safari opens the app correctly.
I don't get any feedback from the Library what might be wrong. Any help would be appreciated.
To Reproduce
/// Login ViewController
let configuration = OIDServiceConfiguration(authorizationEndpoint: authURL,
tokenEndpoint: tokenURL,
issuer: issuerURL)
let request = OIDAuthorizationRequest(configuration: configuration,
clientId: "clientID",
clientSecret: "clientSecret",
scopes: [OIDScopeOpenID, OIDScopeProfile],
redirectURL: URL(string: "https://appSubdomain.domain.com/ios/oauth2/callback")!,
responseType: OIDResponseTypeCode,
additionalParameters: nil)
self.currentAuthorizationFlow = OIDAuthState.authState(byPresenting: request, presenting: presentingVC) { authState, error in
if let authState = authState {
os_log("Got authorization tokens. Access token: %@\nRefresh Token: %@\nIDToken: %@", log: self.logger, type: .debug, authState.lastTokenResponse?.accessToken ?? "DEFAULT_TOKEN", authState.lastTokenResponse?.refreshToken ?? "NONE", authState.lastTokenResponse?.idToken ?? "NONE")
} else {
os_log("Authorization error: %@", log: self.logger, type: .error, error?.localizedDescription ?? "DEFAULT_ERROR")
}
}
/// AppDelegate
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
guard userActivity.activityType == NSUserActivityTypeBrowsingWeb,
let url = userActivity.webpageURL else {
return false
}
if let authorizationFlow = self.currentAuthorizationFlow, authorizationFlow.resumeExternalUserAgentFlow(with: url) {
self.currentAuthorizationFlow = nil
return true
}
return false
}
Expected behavior
I would expect the Safari ViewController to close and continue with the authorization flow.
Smartphone (please complete the following information):
- Device: iPhone XS Simulator
- OS: iOS 12
- Browser: SFSafariViewController
- Version: AppAuth (0.95.0) via Cocoapods
Additional context
Using Swift.
Describe the bug
On your Readme page you state that Universal Links are supported. Unfortunately the SFSafariViewController that gets presented using the
OIDAuthState.authState(byPresenting: request, presenting: presentingVC)does not close once the redirect URL is reached.However, copying the URL from the SFSafariViewController and pasting it into Safari manually triggers the App redirect and continues the auth flow in the
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Boolmethod resulting in getting a valid authToken, refreshToken, idToken.My redirect URL looks like this: https://appSubdomain.domain.com/ios/oauth2/callback
I have added
applinks:appSubdomain.domain.comunder the Associated Domains group in the Target Capabilities. As mentioned before, manually enteringhttps://appSubdomain.domain.com/ios/in Safari opens the app correctly.I don't get any feedback from the Library what might be wrong. Any help would be appreciated.
To Reproduce
Expected behavior
I would expect the Safari ViewController to close and continue with the authorization flow.
Smartphone (please complete the following information):
Additional context
Using Swift.