# Django with custom application returns 403 when trying to authorize

**URL:** <https://community.auth0.com/t/django-with-custom-application-returns-403-when-trying-to-authorize/69321>\
**Category:** Get Help\
**Tags:** login, auth0\
**Created:** [September 8, 2021, 7:18pm UTC](https://community.auth0.com/t/django-with-custom-application-returns-403-when-trying-to-authorize/69321 "2021-09-08T19:18:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matty](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/matty/32/31626_2.png) [@Matty](https://community.auth0.com/u/Matty)\
**Post date:** [September 8, 2021, 7:18pm UTC](https://community.auth0.com/t/django-with-custom-application-returns-403-when-trying-to-authorize/69321/1 "2021-09-08T19:18:59Z")

</div>

I’m trying to mimic the Django SDK example taken from this link:  
[https://auth0.com/docs/quickstart/webapp/django/01-login](https://auth0.com/docs/quickstart/webapp/django/01-login)

Now I have a tenant set up with, amongst others, the “Default App”-application that automatically gets added when creating the tenant, and when testing the app, the environment variables are set as follows:

AUTH0\_CLIENT\_ID={Default App Client\_ID}  
AUTH0\_DOMAIN={tenant\_domain}  
AUTH0\_CLIENT\_SECRET={Default App Client\_Secret}

When running the project with these variables with the exact same code that is located on github ([auth0-django-web-app/01-Login at master · auth0-samples/auth0-django-web-app · GitHub](https://github.com/auth0-samples/auth0-django-web-app/tree/master/01-Login)), then it works, and I get the user-information on screen.

However my problem arises when I switch from the “Default App”-application, to a custom application. Let’s call this application “Custom App” for simplicity. When I try to run the _exact same project_, however with the _only_ difference being the following:

AUTH0\_CLIENT\_ID={Custom App Client\_ID}  
AUTH0\_DOMAIN={tenant\_domain}  
AUTH0\_CLIENT\_SECRET={Custom App Client\_Secret}

then I get the error when trying to login and authorize:

 ![image](https://global.discourse-cdn.com/auth0/original/3X/6/3/63f779e11cc89eed840bb4774fe3f85e8b4c5770.png)

I’ve been struggling to find any solution to this, and I find it difficult to debug what’s going on on the Django-side, and what’s going on on Auth0’s side. Any feedback is appreciated.

---

<div class="post-metadata">

**Author:** ![Matty](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/matty/32/31626_2.png) [@Matty](https://community.auth0.com/u/Matty)\
**Post date:** [September 15, 2021, 1:30pm UTC](https://community.auth0.com/t/django-with-custom-application-returns-403-when-trying-to-authorize/69321/2 "2021-09-15T13:30:54Z")

</div>

Figured out the answer myself thanks to StackOverflow (all hail). The custom application needed to give additional grant types, more specifically Authorization Code. So the solution was to go into the advanced settings of the custom application and select this grant.

---

<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:** [September 30, 2021, 9:26am UTC](https://community.auth0.com/t/django-with-custom-application-returns-403-when-trying-to-authorize/69321/3 "2021-09-30T09:26:15Z")

</div>

Thanks for sharing that 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:** [September 30, 2021, 9:26am UTC](https://community.auth0.com/t/django-with-custom-application-returns-403-when-trying-to-authorize/69321/4 "2021-09-30T09:26:18Z")

</div>


