In my angular 4 app, I’ve built auth.service.ts.
I followed the tutorial to set up the auth and can successfully log into my app. I have attached metadata to my user
app_metadata { “name”: “test” }
The problem is that I’m not sure how to access this data. I’ve followed along the tutorial and created the getProfile() method but I’m not sure how to get to the point to be able to do user.app_metadata.name like it shows in another part of the documentation.
Can someone please help me urgently please? This is time sensitive. I’m not sure if I need to upgrade my account in order to get support.
What scope are you using in your request?
just “openid” for now. Whatever was the one in the quick start tutorial.
I added the property to read app_metadata but then my app stopped logging in so I removed it for now. I just need to get this working.
Hi,
Add a new rule to auth0, like this.
function (user, context, callback) {
if(user.user_metadata && user.user_metadata.name)
user.name = user.user_metadata.name;
callback(null, user, context);
}
add ‘email’ and ‘profile’ to scope
then in you service add this to see result:
this.profile = JSON.parse(localStorage.getItem(‘profile’));
console.log(this.profile);
Okay this is straight from the documentation but where do I get the user, context, and callback to pass into the function?