Auth0 Home Blog Docs

passwordless sms how to getInfo off the code parameter

passwordless
sms

#1

How do I get the users phone number after the callback?
i am using: auth0-lock-passwordless

var lock = new Auth0LockPasswordless('our_token', 'our_domain.au.auth0.com', {
  auth: {
    responseType: 'code'
  }
})
lock.sms({
  authParams: {
    scope: 'openid profile phone_number'
  },
  callbackURL: 'http://127.0.0.1:8080',
}, (err, profile, id_token, access_token, state, refresh_token) => {
  if(err) console.log(err)
  console.log(err, profile, id_token, access_token, state, refresh_token)
})

I need to use the parameter code to get the user’s phone_number the lack of documention on this is bad. Using a callback I can’t get a token so what do I do with the ‘code’ parameter.

Please advice


#2

The responseType of code is intended for server-side, regular web apps. Please confirm the application you are building is a regular web app; if it is a single page application, you should be using responseType: 'token'.

You can follow up with any of the Regular Web App Quickstarts to see how to handle the authentication callback code on the server-side.


#3

Besides responseType: 'token', I guess he will need to add audience: 'https://{yourAuth0domain}/userinfo.


#4