I’m trying to validate the verification code that was send through SMS.
I used the following post call in Postman:
http://<tenant>/oauth/legacy/grant-type/ro
{
"client_id": "id",
"connection": "sms",
"grant_type": "authorization_code",
"username": "phone_num",
"password": "code",
"scope": "openid profile email"
}
But the call is not longer supported for new Auth0 users. So I found another approach using Auth0 AuthenticationAPI but doing so I get
StatusCode = 403
error = invalid_grant
error_description = Invalid authorization code
Any ideas on how to validate the verification code?
using AuthenticationApi implmentation:
var smsReq = new PasswordlessSmsRequest();
smsReq.ClientId = clientId;
smsReq.PhoneNumber = someNum;
var authApi = new AuthenticationApiClient(domain);
var task = authApi.StartPasswordlessSmsFlowAsync(smsReq);
var res = task.Result;
var alert = new AlertDialog.Builder(CrossCurrentActivity.Current.Activity);
var edit = new EditText(CrossCurrentActivity.Current.Activity) { Hint = "Enter Code" };
alert.SetView(edit);
alert.SetTitle("title");
alert.SetPositiveButton("OK", (senderAlert, args) =>
{
var tokReq = new AuthorizationCodeTokenRequest();
tokReq.ClientId = clientId;
tokReq.ClientSecret = clientSecret;
tokReq.Code = edit.Text;
tokReq.RedirectUri = uri;
var auResTask = authApi.GetTokenAsync(tokReq);
var autRes = auResTask.Result;
});
alert.SetNegativeButton("Cancel", (senderAlert, args) =>
{
});
alert.Show();