On iOS, while using Lock, we’re adding a custom textfield to let user type in their first name.
I see this is then stored in user_metadata
.
It seems like I can’t get this firstName from the profile though:
Lock
.classic()
.withStyle {
$0.hideTitle = true
}
.withOptions {
$0.oidcConformant = true
$0.scope = "openid profile email"
$0.audience = "xxxxxxxxxxx"
$0.initialScreen = .signup
$0.allow = [.Signup]
$0.customSignupFields = [
CustomTextField(name: "firstName", placeholder: "Your first name", icon: LazyImage(name: "ic_person", bundle: Lock.bundle))
]
$0.termsOfService = "https://mycompany.com/terms"
$0.privacyPolicy = "https://mycompany.com/privacy"
}
.onAuth { credentials in
if self.credentialsManager.store(credentials: credentials) {
guard let accessToken = credentials.accessToken else { return }
self.testApiCallWithToken(token: accessToken, completionHandler: { (response) in
// do smth
})
Auth0
.authentication()
.userInfo(withAccessToken: accessToken)
.start { result in
print(result)
switch result {
case .success(let profile):
// How do I get user firstName now? profile.user_metadata isnt accessible
case .failure(let error):
print(error)
}
}
}
}
.present(from: self)
Am I missing something?
Thank you in advance!