# /userinfo dj-rest-auth

**URL:** <https://community.auth0.com/t/userinfo-dj-rest-auth/76545>\
**Category:** Get Help\
**Tags:** spa, django, api, auth0, login\
**Created:** [January 17, 2022, 7:17pm UTC](https://community.auth0.com/t/userinfo-dj-rest-auth/76545 "2022-01-17T19:17:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dhruvsingh](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dhruvsingh/32/33194_2.png) [@dhruvsingh](https://community.auth0.com/u/dhruvsingh)\
**Post date:** [January 17, 2022, 7:17pm UTC](https://community.auth0.com/t/userinfo-dj-rest-auth/76545/1 "2022-01-17T19:17:33Z")

</div>

I’m trying to integrate Auth0 with [dj-rest-auth](https://dj-rest-auth.readthedocs.io/en/latest/introduction.html) which is built on top of [all-auth](https://django-allauth.readthedocs.io/en/latest/providers.html#auth0).  
I correctly set the settings on Django Rest Framework side, but I’m unsure about:

1. What should the url for `AUTH0_URL` be? Is it the same as `domain` from the Auth0 application?
2. I generated an `access_token` by setting up a machine to machine application in the Auth0 dashboard (is this the correct `access_token` to use?)

**Context for 1** :  
Setting the `AUTH0_URL = domain` does not work for me, which always gives a 401, Unauthorized response to `/userinfo` endpoint.  
If I set it to `api/v2/userinfo`, the request goes through but I always get a 404 response as `{"statusCode":404,"error":"Not Found","message":"Not Found"}`

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [January 20, 2022, 9:37pm UTC](https://community.auth0.com/t/userinfo-dj-rest-auth/76545/3 "2022-01-20T21:37:49Z")

</div>

Welcome to the Auth0 Community!

> [@dhruvsingh](#):
>
> What should the url for `AUTH0_URL` be? Is it the same as `domain` from the Auth0 application?

It looks like that SDK is expecting the entire base URL of your tenant. If you go to this doc and log in it will populate the correct base URL: [https://auth0.com/docs/api/authentication](https://auth0.com/docs/api/authentication).

> [@dhruvsingh](#):
>
> If I set it to `api/v2/userinfo`

Userinfo is not an an api/v2 endpoint. You can use the same doc I linked above to find your exact URL for the userinfo endpoint.

> [@dhruvsingh](#):
>
> 1. I generated an `access_token` by setting up a machine to machine application in the Auth0 dashboard (is this the correct `access_token` to use?)

A M2M access token from the dashboard will not be associated with a user and will not return anything from the userinfo endpoint. This may be the core of your issue. You need to log in to return a user’s access token.

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [March 14, 2022, 6:18pm UTC](https://community.auth0.com/t/userinfo-dj-rest-auth/76545/4 "2022-03-14T18:18:03Z")

</div>


