Retrieve user given_name

Hey all -

I successfully set up my Angular SPA with Auth0 but I’m having trouble retrieving the “given_name” or any properties from the user object in order to display it in the profile page or use it in the navbar. How would I retrieve those values?

After login in to my app, I can see the following under the profile page:

  "given_name": "XXX",
  "family_name": "XXX",
  "nickname": "XXX",
  "name": "XXX XXX",
  "picture": "XX",
  "locale": "en",
  "updated_at": "2020-03-29T22:52:33.377Z",
  "email": "",
  "email_verified": true,
  "sub": "XXX"

And I have this under the profile.component.html:

<pre *ngIf="auth.userProfile$ | async as profile ">

   {{ profile | json }}

Any help would be appreciated it! Thanks!

Hi @loct,

Welcome to the Community!

You should be able to retrieve them using object properties syntax. For example, instead of retrieving the entire profile with {{ profile }}, you could get just the given name with {{profile.given_name}}. Does that make sense?


1 Like

Hi @dan.woda -

That worked! Thank you for the detailed reply, I appreciate it!

1 Like

No problem! good luck :smile:

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.