Skip to content
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

LoginManager.executeNativeAuthenticators returns nil error on iOS 13 #262

Open
RaytIgor opened this issue Nov 15, 2019 · 2 comments
Open

Comments

@RaytIgor
Copy link

RaytIgor commented Nov 15, 2019

Good Day!

I am having issues authorizing via rides sdk. The authorization issue came up with ios 13.
The difference in behaviour between iOS 12 and iOS 13 takes place in the executeNativeAuthenticators method in the LoginManager class:

private func executeNativeAuthenticators(authenticators: [UberAuthenticating], completion: @escaping ((_ fallback: Bool) -> Void)) {
        var fallback: Bool = false
        AsyncDispatcher.exec(for: authenticators.map({ return $0.authorizationURL }),
                             with: { (url: URL) in
                                self.authenticator = authenticators.first(where: { $0.authorizationURL == url })
                             },
                             asyncMethod: DeeplinkManager.shared.open(_:completion:),
                             continue: { (error: NSError?) -> Bool in
                                fallback = false

                                if error == nil {
                                    // don't try next native authenticator
                                    return false
                                }

                                // If the user rejected the attempt to call the Uber app, don't use fallback.
                                if self.loginType == .native, error?.code == DeeplinkErrorType.deeplinkNotFollowed.rawValue {
                                    self.loginCompletion(accessToken: nil, error: UberAuthenticationErrorFactory.errorForType(ridesAuthenticationErrorType: .unableToPresentLogin))

                                    // don't try next native authenticator
                                    return false
                                } else {
                                    fallback = true
                                }

                                // try next native authenticator
                                return true
                             },
                             finally: {
                                completion(fallback)
                             })
    }

My authenticator URL is uberauth://connect?third_party_app_name=[REDACTED]&callback_uri_string=[REDACTED]://oauth/consumer&client_id=[REDACTED]&scope=[scopes]&sdk=ios&sdk_version=0.12.0

On iOS 12, I’m seeing the closure passed to continue param returns true. The error given in the closure is non-nil, thus logic continues and authorizes my application.
However, on iOS 13 I’m seeing the error is nil so it returns false immediately, thus the authorization logic exists right away
Then I receive [REDACTED]/oauth/consumer?error=jwt_creation_failure from AppDelagate application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey: Any] = [:])
And finally, I receive “The server was unable to understand your request” from loginButton(_ button: LoginButton, didCompleteLoginWithToken accessToken: AccessToken?, error: NSError?)

FYI, the authorization via web browser still works as expected.

The same issue reported on StackOverflow:
https://stackoverflow.com/questions/58868478/uber-sso-errors-with-jwt-creation-failture

@RaytIgor RaytIgor changed the title LoginManager.executeNativeAuthenticators returns empty error on ios13 LoginManager.executeNativeAuthenticators returns nil error on iOS 13 Nov 15, 2019
@Igorsnaki
Copy link

+1 also receive the same issue starting from iOS 13.2

@RaytIgor
Copy link
Author

@Igorsnaki did you manage to find any workaround?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants