2017-09-03 115 views
0

我用Auth0网络登录设置了一个Swift应用程序,一切正常。然后,我尝试实施“锁定”登录,结果社交媒体登录效果非常好,但我无法通过用户名 - 密码方法登录。验证码“锁定”为Swift用户名密码登录不起作用

在我的Auth0数据库上,注册用户出现(表示注册新用户名-passoword用户实际工作)并在Auth0主页上测试登录本身也能正常工作。就在尝试使用Lock小部件登录时,我收到一个错误:“我们很抱歉,尝试登录时出错了。”我也尝试验证注册的电子邮件,但那也没有解决问题。 任何想法,这里可能会出现什么问题?

回答

0

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