iOS SDK - Error handling and Universal Login

Hi,

On our iOS app, we are implementing Universal Login. Here’s the code snippet for doing so:

public func login() async throws -> AuthToken {
        do {
            let credentials = try await Auth0.webAuth(
                clientId: [OUR_CLIENT_ID],
                domain: [OUR_DOMAIN],
                session: urlSession // instance of URLSession created by us
            )
            .useEphemeralSession()
            .scope([OUR_SCOPE])
            .audience([OUR_AUDIENCE])
            .start()

            return AuthToken(credentials: credentials)
        } catch {
            // What errors can be thrown and which ones should we handle? 
            throw error
        }
}

We would like to understand the type of errors that can be thrown as the documentation doesn’t speak to this from what we’ve found.

Our hunch is that the list of errors that could be thrown are listed here.

Is that correct?

Hey there!

Yes that is correct (when we’re speaking about errors thrown out by the SDK) but also here you have a list of Common Auth0 Library Authentication Errors:

and if you are interested in log events specific errors then you can find them here:

Thanks for the quick response @konrad.sopala. I think where my confusion stems from is there are errors listed in Common Auth0 Library Authentication Errors Docs you linked such as invalid_user_password that would only be thrown within the Universal Login flow. Our app for example would not have any knowledge that a user entered a wrong password (i.e. the code snippet I linked above catch block isn’t called if a user enters an incorrect password).

Is my understanding accurate? If so, I’m specifically interested in what errors could actually come through in the catch block I linked above.

I think that’s correct but let me confirm it with my colleague who is actually maintaining this repo.

Okay got a confirmation from the team that this will be all the errors you can get:

Thank you very much @konrad.sopala !

1 Like

No worries! We’re here for you!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.