let domain = "...."
Auth0
.webAuth()
.audience("https://" + domain + "/userinfo")
.connection("google-oauth2")
.parameters(["prompt":"login"])
.scope("openid profile email offline_access")
.start { [weak self] result in
DispatchQueue.main.async {
switch result {
case .success(let credentials):
self?.handleLoginCredentials(credentials: credentials)
case .failure(let error):
if let err = error as? URLError, err.code == URLError.Code.notConnectedToInternet {
self?.loginDelegate?.onLoginFail(.networkError)
} else {
self?.loginDelegate?.onLoginFail(.notAllowed)
}
}
}
}
Error:
Error Domain=com.apple.AuthenticationServices.WebAuthenticationSession Code=2 “Cannot start ASWebAuthenticationSession without providing presentation context. Set presentationContextProvider before calling -start.” UserInfo={NSDebugDescription=Cannot start ASWebAuthenticationSession without providing presentation context. Set presentationContextProvider before calling -start.}