# Angular4: How to access user profile?

**URL:** <https://community.auth0.com/t/angular4-how-to-access-user-profile/8546>\
**Category:** Get Help\
**Tags:** angular4, user-profile, users, metadata\
**Created:** [October 22, 2017, 12:01pm UTC](https://community.auth0.com/t/angular4-how-to-access-user-profile/8546 "2017-10-22T12:01:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jasonshihprofessiona](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@jasonshihprofessiona](https://community.auth0.com/u/jasonshihprofessiona)\
**Post date:** [October 22, 2017, 12:01pm UTC](https://community.auth0.com/t/angular4-how-to-access-user-profile/8546/1 "2017-10-22T12:01:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![oliver.john](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@oliver.john](https://community.auth0.com/u/oliver.john)\
**Post date:** [October 23, 2017, 2:28pm UTC](https://community.auth0.com/t/angular4-how-to-access-user-profile/8546/2 "2017-10-23T14:28:49Z")

</div>

What scope are you using in your request?

---

<div class="post-metadata">

**Author:** ![jasonshihprofessiona](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@jasonshihprofessiona](https://community.auth0.com/u/jasonshihprofessiona)\
**Post date:** [October 23, 2017, 7:11pm UTC](https://community.auth0.com/t/angular4-how-to-access-user-profile/8546/3 "2017-10-23T19:11:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![tonidzalto](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@tonidzalto](https://community.auth0.com/u/tonidzalto)\
**Post date:** [October 30, 2017, 2:34pm UTC](https://community.auth0.com/t/angular4-how-to-access-user-profile/8546/4 "2017-10-30T14:34:20Z")

</div>

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);

---

<div class="post-metadata">

**Author:** ![jasonshihprofessiona](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@jasonshihprofessiona](https://community.auth0.com/u/jasonshihprofessiona)\
**Post date:** [October 30, 2017, 8:00pm UTC](https://community.auth0.com/t/angular4-how-to-access-user-profile/8546/5 "2017-10-30T20:00:54Z")

</div>

Okay this is straight from the documentation but where do I get the user, context, and callback to pass into the function?

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [March 2, 2018, 5:57am UTC](https://community.auth0.com/t/angular4-how-to-access-user-profile/8546/6 "2018-03-02T05:57:05Z")

</div>


