# Django Auth0 Read user\_metadata

**URL:** <https://community.auth0.com/t/django-auth0-read-user-metadata/67976>\
**Category:** Get Help\
**Tags:** app\_metadata, django, user\_metadata, auth0\
**Created:** [August 15, 2021, 11:41pm UTC](https://community.auth0.com/t/django-auth0-read-user-metadata/67976 "2021-08-15T23:41:05Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![uripre](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/uripre/32/31152_2.png) [@uripre](https://community.auth0.com/u/uripre)\
**Post date:** [August 15, 2021, 11:41pm UTC](https://community.auth0.com/t/django-auth0-read-user-metadata/67976/1 "2021-08-15T23:41:05Z")

</div>

After following auth0’s quick start, I can’t seem to find a way to access the logged-in user’s “user\_metadata” in django. Anyone else tried to achieve this with django and can share how?

I followed the following quick start:

> **[Auth0 Django SDK Quickstarts: Login](https://auth0.com/docs/quickstart/webapp/django/01-login)**
>
> This tutorial demonstrates how to add user login to a Python web application built with the Django framework and Authlib OAuth library.

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [August 16, 2021, 11:18am UTC](https://community.auth0.com/t/django-auth0-read-user-metadata/67976/2 "2021-08-16T11:18:01Z")

</div>

Hey there!

Hmm it’s indeed not documented there. Let me do a bit of research and get back to you once I find something

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [August 16, 2021, 11:19am UTC](https://community.auth0.com/t/django-auth0-read-user-metadata/67976/3 "2021-08-16T11:19:31Z")

</div>

Have you tried accessing request.user object properties and looking there?

---

<div class="post-metadata">

**Author:** ![uripre](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/uripre/32/31152_2.png) [@uripre](https://community.auth0.com/u/uripre)\
**Post date:** [August 16, 2021, 1:09pm UTC](https://community.auth0.com/t/django-auth0-read-user-metadata/67976/4 "2021-08-16T13:09:26Z")

</div>

Yes, I’m not seeing anything relevant there. I also tried to add a Rule in order to inject the value from the user\_metadata into the accessToken with a custom namespace, and then to request it as one of the scopes/claims. Can’t see it made any difference, the data is also not in the UserSocialAuth.extra\_data field.

---

<div class="post-metadata">

**Author:** ![uripre](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/uripre/32/31152_2.png) [@uripre](https://community.auth0.com/u/uripre)\
**Post date:** [August 17, 2021, 1:03am UTC](https://community.auth0.com/t/django-auth0-read-user-metadata/67976/6 "2021-08-17T01:03:10Z")

</div>

I finally managed to do it. Follow these steps:

1. Add a rule in Auth0’s interface, adding the desired metadata parameter to the idToken, as shown in the bottom of [this page](https://auth0.com/docs/scopes/sample-use-cases-scopes-and-claims).
2. Add the same claim including its namespace to the claims in django, the SOCIAL\_AUTH\_SCOPE (not SOCIAL\_AUTH\_AUTH0\_SCOPE as shown in the quickstart) list in the settings made it for me.
3. Extending the get\_user\_details function as shown in the [django quickstart guide](https://auth0.com/docs/quickstart/webapp/django/01-login) and adding the new relevant fields to the EXTRA\_DATA mapping.

Then it worked for me, and the variable made its way into user.social\_auth.get(provider=‘auth0’).extra\_data.

Hope that would help other people.

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [August 17, 2021, 9:42am UTC](https://community.auth0.com/t/django-auth0-read-user-metadata/67976/7 "2021-08-17T09:42:39Z")

</div>

Wohoo! Glad to hear that and thanks for sharing with the rest of community!

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [August 26, 2021, 9:22am UTC](https://community.auth0.com/t/django-auth0-read-user-metadata/67976/8 "2021-08-26T09:22:34Z")

</div>


