在将该问题指向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客户端时和使用时,将不可避免取消选中’客户端