Auth0.getProfile gives back undefined (Node.js and Firebase)

Hi all,

I am trying to implement (for the first time) Auth0 for my Google Action. I used this tutorial and most of it seems to be working. However when I execute the code and check the logs I don’t get anything back from getProfile. It simply states undefined.

The code I use:

const {AuthenticationClient} = require('auth0');

const auth0 = new AuthenticationClient({
  'domain': 'MYDOMAIN.eu.auth0.com',
});

const app = smarthome();

const getEmail = async (headers) => {
  console.log(headers);
  const accessToken = headers.authorization.substr(7);
  console.log(accessToken);
  const {email} = await auth0.getProfile(accessToken);
  console.log(email);
  return email;
};

So when getEmail is called I don’t get any value, while accessToken is filled and I can’t figure out why.

1 Like

Have you tried including clientid as in code snippet ? ; const auth0 = new AuthenticationClient({
‘clientId’: ‘clientIdentifier’,
‘domain’: ‘.auth0.com’
});

I am following the example given in 01-Login in the auth0-examples, and it turns out I can’t get basic login prompt working. Here I provide the error message and the source related and hope to get help so that I can start using Auth0 official website

Hi,

Yes, that was what I had first (but literally with the word clientIdentifier in it) but that didn’t work either.

The other thing I changed is in:

const app = smarthome({
jwt: require(‘./service-account-key.json’)
});

I don’t have any json file included since I don’t know what file to include here? (If it is not from Auth0 it doesn’t seem to be needed either).

Btw how does Auth0 knows they can give back information at all if I use getProfile on firebase functions, how does Auth0 know I can ask information from the firebase domain? (Since the only domains I added in Auth0 config are the ones from Google Actions (which call Firebase after the login prompt)

Sorry, what do you mean with this?