在將該問題指向Auth0/Lock支持之後,找到了解決方案。也許這可以幫助人,有同樣的問題:當使用一些VC裏面的鎖客戶端:
Lock
.classic()
.withOptions {
$0.scope = "openid profile"
$0.oidcConformant = true
$0.logHttpRequest = true
}
.withStyle {
$0.title = "App Name"
}
.onAuth { credentials in
print("successful login")
}
.onError { error in
print("Failed with error \(error)")
}
.present(from: self)
,而不是Web登錄:
Auth0
.webAuth()
.audience("https://alienbash.eu.auth0.com/userinfo")
.start {
switch $0 {
case .failure(let error):
// Handle the error
print("Error: \(error)")
case .success(let credentials):
// Do something with credentials e.g.: save them.
// Auth0 will automatically dismiss the hosted login page
print("Credentials: \(credentials)")
}
}
一個必須確保改變「Grant_Type」的Auth0客戶端設置也允許「密碼」授予。爲了做到這一點,在你Auth0客戶端去:
Settings --> Advances Settings --> Grant Types
,並確保檢查鎖定‘「密碼,因爲這勾選默認情況下,創建一個新的Auth0客戶端時和使用時,將不可避免取消選中’客戶端