Skip to content

Instantly share code, notes, and snippets.

@leecrossley
Created September 8, 2022 17:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leecrossley/5509997ab661fa6cc7785715cc9b1eb4 to your computer and use it in GitHub Desktop.
Save leecrossley/5509997ab661fa6cc7785715cc9b1eb4 to your computer and use it in GitHub Desktop.
Auth0 passwordless example (react native)
auth0.auth
.passwordlessWithSMS({
phoneNumber: "+447555555555", // validate input - format +44
send: "code",
})
.then(goToVerifyCode)
.catch(() => {
Alert.alert(
"We're sorry!",
"We couldn't send your code, please check your number and try again.",
);
});
auth0.auth
.loginWithSMS({
phoneNumber: "+447555555555", // from earlier
code: "123456", // code input from sms
scope: "openid offline_access", // offline access required for refresh token
})
.then(goToApp)
.catch(failLogin);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment