Please include the following information in your post:
- Which SDK this is regarding: e.g. auth0-ios
- SDK Version: 1.0
- Platform Version: iOS 14.6
Auth0
.webAuth()
.scope("openid profile offline_access")
.audience("https://staging.savvy-api.com/")
.start { result in
switch result {
case .failure(let error):
print("Error: \(error)")
NotificationCenter.default.post(name: authenticationFailed, object: nil)
return promise(.failure(.authFailure))
case .success(let credentials):
guard let token = credentials.accessToken,
let expiresIn = credentials.expiresIn else {
return promise(.failure(.authFailure))
}
keychain.setString(token, forKey: API.accessToken)
userDefaults.set(expiresIn, forKey: API.expiresIn)
DispatchQueue.main.async {
NotificationCenter.default.post(name: didAuthenticate, object: nil)
}
return promise(.success(token))
}
}