Auth0 Home Blog Docs

passwordless sms how to getInfo off the code parameter



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

var lock = new Auth0LockPasswordless('our_token', '', {
  auth: {
    responseType: 'code'
  authParams: {
    scope: 'openid profile phone_number'
  callbackURL: '',
}, (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


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.


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