I ve bind Auth0 Client to Twilio to Authenticate via SMS (like it’s described in documentation).
Here is my code to authenticate via SMS (iOS native client):
Lock
.passwordless()
.withOptions {
$0.oidcConformant = false
$0.logLevel = .all
$0.logHttpRequest = true
$0.passwordlessMethod = .code
}
.withConnections({
$0.sms(name: "sms")
})
.onPasswordless(callback: { (indata) in
Log.info("ON PASSWORDLESS: \(indata)")
})
.onAuth { credentials in
print("Authenticated!")
guard let accessToken = credentials.accessToken else { return }
Log.info("ACCESS TOKEN: \(accessToken)")
}
.onSignUp { email, attributes in
Log.info("NEW USER WITH EMAIL: \(email)!")
}
.onError { error in
Log.info("FAILED WITH ERROR: \(error.localizedDescription)")
}
.present(from: self)
As a response i get an error:
INFO | PasswordlessPresenter.swift:79 - Login passwordless 4372896051 with passcode using connection: sms
POST https://solocez.auth0.com/oauth/ro HTTP/1.1
Auth0-Client: eyJuYW1lIjoiTG9jay5zd2lmdCIsInZlcnNpb24iOiIyLjUuMSIsImxpYl92ZXJzaW9uIjoiMS4xMC4wIn0
Content-Type: application/json
{“grant_type”:“password”,“client_id”:“XbwI4jUhfLsHGuptRxo0oleUZ6APPetd”,“connection”:“sms”,“scope”:“openid”,“username”:“+14372896051”,“password”:“632259”}
HTTP/1.1 404
Content-Type: text/plain; charset=utf-8
Content-Length: 9
x-ratelimit-reset: 1519226539
x-auth0-requestid: 75ca685a1da7c7b4c44c
x-ratelimit-limit: 10
x-ratelimit-remaining: 9
Date: Wed, 21 Feb 2018 15:22:18 GMT
Cache-Control: private, no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Not Found
ERROR | DatabaseAuthenticable.swift:82 - Failed login of user <+14372896051> with error Not Found
ERROR | PasswordlessPresenter.swift:86 - Failed with error couldNotLogin
2018-02-21 10:22:18.189314-0500 Wallet[2189:842833] [Info] [main] [LoginViewController.swift:173] showMainScreen() > FAILED WITH ERROR: The operation couldn’t be completed. (Lock.CredentialAuthError error 4.)
What’s wrong ?
Seems like there is no user created. But what 's than a pattern to SMS Authentication?