I have a web app served with Node/Express which presently works fine.
I’m trying to set up a separate tenant for my dev/test environment so I don’t have to pollute the login database with test users.
But I’m guessing the existing tenancy had a bunch of legacy options enabled which are no longer available for new signups, as my app no longer receives all the relevant information.
I’m using passport-auth0
which calls the /userinfo
endpoint as far as I’m aware.
Using the existing tenant I get something back like this:
{ auth0Id: 'auth0|59a1....',
auth0:
{ accessToken: 'Azy2W6Y5....',
profile:
{ provider: 'auth0',
displayName: 'al@twohill.nz',
id: 'auth0|59a1....',
user_id: 'auth0|59a1....',
name: [Object],
emails: [Array],
picture:
'https://s.gravatar.com/avatar/...',
nickname: 'al',
identities: [Array],
_json: [Object],
_raw:
'{"email":"al@twohill.nz","user_metadata":{"title":"Monsieur","given_name":"Al","family_name":"Twohill","lang":"fr"},"name":"al@twohill.nz","picture":"https://s.gravatar.com/avatar/...","nickname":"al","app_metadata":{"role":"client"},"role":"client","email_verified":false,"clientID":"68BHX6LhcnFq....","updated_at":"2018-10-23T08:27:19.643Z","user_id":"auth0|59a1....","identities":[{"user_id":"59a1....","provider":"auth0","connection":"Username-Password-Authentication","isSocial":false}],"created_at":"2017-08-26T21:39:29.871Z","sub":"auth0|59a1...."}'
}
}
}
Which as you can see includes all the information such as app_metadata
etc.
With the new tenancy I get a different response
{ auth0Id: 'auth0|5bce966f9a...',
auth0:
{ profile:
Profile {
displayName: '....client1@gmail.com',
id: 'auth0|5bce966f9a...',
user_id: 'auth0|5bce966f9a...',
name: [Object],
picture:
'https://s.gravatar.com/avatar/...',
nickname: '....client1',
_json: [Object],
_raw:
'{"sub":"auth0|5bce966f9a...","nickname":"....client1","name":"....client1@gmail.com","picture":"https://s.gravatar.com/avatar/...","updated_at":"2018-10-23T08:16:55.756Z"}' },
accessToken: 'W4fnoDB_0ja8C_...',
refreshToken: undefined }
}
This doesn’t have any of the app_metadata
in it!
I’ve read the docs here User Profile Structure and here Understand How Metadata Works in User Profiles but I’ve become thoroughly confused. There is mention of having to create a rule to expose metadata (which I tried but it seems really hard!) or I have to “utilize one of the User endpoints of the Management API”.
Am I missing something or has this gotten unbearably hard? I’m nearly ready to throw in the towel and write my own authentication!