auth0/Lock.swift

UserInfo not giving the complete Information about the User.

kongesh opened this issue · 1 comments

UserInfo not giving the complete Information about the User.

Description

  • Using UserInfo API I am getting only this data

{"sub":"auth0|5f17d80c0620c40019a5da98","nickname":"kongesh+10","name":"kongesh+10@gmail.com","picture":"https://s.gravatar.com/avatar/7ec51fab3a1c3bbdec63f2182d0861cf?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fko.png\",\"updated_at\":\"2020-07-29T13:38:00.734Z\"}".

  • In UserProfile, I'm not getting EmailVerified and Email key from the UserProfile. Even if the user is verified his email.

  • Screenshot 2020-07-29 at 11 19 02 PM

Please refer the below code:

private func InitialSetup(){
           Lock
               .classic()
               .withOptions {
                   applyDefaultOptions(&$0)
                   
                   //                $0.enterpriseConnectionUsingActiveAuth = ["testAD"]
                   $0.closable = true
                   $0.oidcConformant = true
                   $0.scope = "openid profile"
                   $0.audience = "http://******"
                  
                  
           }.allowedConnections(["Username-Password-Authentication"])
               .withStyle {
                   applyPhantomStyle(&$0)
           }.onAuth(callback: { (creadential) in
               
               guard let accesToken = creadential.accessToken else{return}
               guard let token_type = creadential.tokenType else {return}
               let token = token_type + " " + accesToken
              
               DispatchQueue.main.asyncAfter(deadline: .now()) {
                   self.authoProfile(token: accesToken)
               }
           })
               .present(from: self)
   }

func authoProfile(token: String){
       Auth0
       .authentication()
       .userInfo(withAccessToken: token)
       .start { result in
           switch result {
           case .success(let profile):
               self.dataSource = profile
             
           case .failure(let error):
               print("Failed with \(error.localizedDescription)")
           }
       }

Environment

Please provide the following:

  • Lock version: 2.0
  • iOS version: 10.15.2
  • Xcode version: 11.4

Hi @kongesh, I see you're using the openid profile scope. You need to add the email scope as well. Check out this Auth0 Community thread for more info.