Problem statement
We use the following code in our login flow:
Auth0.webAuth()
.start { result in
switch result {
case .success(let credentials):
print("~~Credentials: \(credentials)")
case .failure(let error):
print("~~Error: \(error)")
}
}
Calling the start()
function successfully shows the Universal Login page in a modal in-app Safari. A magic link is sent successfully to the user’s email. Then tapping the magic link opens the app successfully, so the deep-linking works.
However, the callback to the start()
function does not get invoked at all. The expectation is that it will be called, with a successful result that contains the user credentials as an associated value.
Moreover, dismissing the modal after the magic link opens the app invokes the start()
callback with a failure result, stating that the user canceled the authentication flow.
Cause
For Auth0.Swift, the passwordless flow with magic links is not supported through the Universal Login page, even if a universal link does return to the iOS application.
Solution
Magic Links are only supported through the embedded passwordless flow described here Auth0.swift: Passwordless Authentication.