Auth0 Home Blog Docs

With Passport.js a successful authentication returns an empty profile



Everything works but the Auth0Strategy callback receives an empty profile, like this:

Profile { displayName: undefined, id: undefined, name: { familyName: undefined, givenName: undefined }, _json: {}, _raw: '{}' }

I was using passportjs with google-oauth2 and facebook strategies and I did not have this problem.

What can I try to make this work?


On possible cause is that you’re not providing the necessary scopes in order for the response to contain actual user information. You may want to try the following option when you create the strategy:

(...) Auth0Strategy({
    // other options here...
    scope: "openid email profile"
  }, (...)

The above scope configuration should return email address information and also user profile information like name and display name assuming the end-user has that information set on their profile.