简体   繁体   English

Swift用户名-密码登录的Auth0“锁定”不起作用

[英]Auth0 “Lock” for Swift Username-Password Login not working

I have set up a Swift App with the Auth0 Web Login and everything works fine. 我已经使用Auth0 Web登录设置了Swift应用,一切正常。 Then i have tried to implement the "Lock" login with the result that social media login works perfectly well, but i cannot login via the username-password method. 然后,我尝试实现“锁定”登录,结果社交媒体登录可以很好地工作,但是我无法通过username-password方法登录。

On my Auth0 database, the signed-up user shows up (indicating that sign up of new username-passoword user actually work) and testing the login itself on the Auth0 Homepage works fine as well. 在我的Auth0数据库上,会显示已注册的用户(表明新用户名密码用户的注册确实有效),并且在Auth0主页上测试登录本身也可以正常工作。 Just when trying to login with the Lock widget, i get an error: "We're sorry, something went wrong when attempting to log in.". 刚尝试使用Lock小部件登录时,出现错误:“很抱歉,尝试登录时出了点问题。” I also tried verifying the registered E-Mail, but that did not solve the issue either. 我也尝试验证已注册的电子邮件,但这也不能解决问题。 Any ideas, what might go wrong here? 任何想法,这里可能出什么问题?

After also pointing that issue out to Auth0/Lock support, a solution was found. 在也指出该问题为Auth0 / Lock支持之后,找到了解决方案。 Maybe this helps people, having the same problem: When using the Lock client inside some VC: 也许有同样的问题,这可以帮助人们:在某些VC中使用Lock客户端时:

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)

instead of the web login: 而不是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)")
    }

}

one has to make sure to change "Grant_Type" the Auth0 client settings to also allow the "Password" Grant. 必须确保更改Auth0客户端设置的“ Grant_Type”,以同时允许“密码”授予。 In order to do that, in your Auth0 client go to: 为此,请在您的Auth0客户端中转到:

Settings --> Advances Settings --> Grant Types 设置->高级设置->授予类型

and make sure to check "Password as this checkmark is unchecked by default when creating a new Auth0 client and will be inevitable when using the "Lock" client. 并确保在创建新的Auth0客户端时默认选中“密码,因为此复选标记未选中,在使用“锁定”客户端时将不可避免。 在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Auth0 Swift SDK .authentication()。login返回无效令牌 - Auth0 Swift SDK .authentication().login returning invalid token 使用 NSUserDefault 保存用户名密码,安全性如何以及安全性如何? - Save username-password with NSUserDefault, how and how much safe? 当我开始使用 WKWebViewOnly 时,Auth0 登录停止工作 - Auth0 login stop working when I started using WKWebViewOnly 如何为 Auth0 Lock iOS SDK 指定自定义重置密码 URL? - How can I specify a custom reset password URL for Auth0 Lock iOS SDK? 使用数据库连接登录Auth0的锁时,为什么不存在其他参数 - Why are additional parameters not present when using database connection for login on Auth0's Lock 使用iOS钥匙串服务保存用户名密码,安全性和安全性如何? - Save username-password with iOS Keychain Services., how and how much safe? 用户名和密码中的基本身份验证标头在AFNetworking 2.0中不起作用 - Basic auth header from username and password is not working In AFNetworking 2.0 如何直接在Auth0中登录而不重定向通用登录页面? - How to login directly in Auth0 without redirect universal login page? iOS-使用用户名和密码的Twitter登录 - iOS - Twitter login with username and password 解析用户名/密码登录错误 - Parse username/password login error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM