Hi everyone,
I’m trying to create an embedded passwordless login in my react native app following this guide:
https://auth0.com/docs/authenticate/passwordless/implement-login/embedded-login/native
I’m using SMS codes.
I’m able to receive a code in my phone but when i send back a post request to validate it I get this error:
error: "invalid_grant"
error_description: "Wrong phone number or verification code."
This is code I use:
var axios = require("axios").default;
var options = {
method: 'POST',
url: 'https://{yourDomain}/oauth/token',
headers: {'content-type': 'application/json'},
data: {
grant_type: 'http://auth0.com/oauth/grant-type/passwordless/otp',
client_id: '{yourClientId}',
username: 'USER_PHONE_NUMBER',
otp: 'code', // I placed here the code received
realm: 'sms',
audience: 'your-api-audience',
scope: 'openid profile email'
}
};
axios.request(options).then(function (response) {
console.log(response.data);
}).catch(function (error) {
console.error(error);
});
My problem is that It’s not clear where should I put the code received. I placed the CODE received in the “opt” attribute.
Also, why it’s also asking for a username?.
thanks in advanced for your help.