Django admin UI page: Oauth 2 isn't working
sbordiya opened this issue · 3 comments
I've a django angular application. The accessTokenAcceptedVersion =1 on my azure app manifest works for django admin (http://localhost:8000/admin) but when I change it to version accessTokenAcceptedVersion =2 it stops authenticating and shows me message as "login failed".
I'm using MSAL for the angular side which works with accessTokenAcceptedVersion =2. How do i enable django side to work Oauth 2.0? Here is my stack:
Python== 3.9.18
Django==3.2.*
angular==15.2
msal-angular==2.5.8
Thank you!
Upvote & Fund
- We're using Polar.sh so you can upvote and help fund this issue.
- We receive the funding once the issue is completed & confirmed by you.
- Thank you in advance for helping prioritize & fund our backlog.
Have you also configured django-auth-adfs to use token version 2?
Please also read the troubleshooting section in the docs.
@JonasKs @sbordiya I'm facing the same issue when logging in /admin in my RDF App.
Django==5.0.6
djangorestframework==3.15.1
django-auth-adfs==1.14.0
I use Microsoft Entra ID.
Here are the logs
ai-pie-backend-web-1 | 2024-09-24 13:02:31 INFO [django_auth_adfs:232] Loaded settings from ADFS server.
ai-pie-backend-web-1 | 2024-09-24 13:02:31 INFO [django_auth_adfs:233] operating mode: openid_connect
ai-pie-backend-web-1 | 2024-09-24 13:02:31 INFO [django_auth_adfs:234] authorization endpoint: https://login.microsoftonline.com/88c47249-96a0-4999-aad9-838f5579a30d/oauth2/v2.0/authorize
ai-pie-backend-web-1 | 2024-09-24 13:02:31 INFO [django_auth_adfs:235] token endpoint: https://login.microsoftonline.com/88c47249-96a0-4999-aad9-838f5579a30d/oauth2/v2.0/token
ai-pie-backend-web-1 | 2024-09-24 13:02:31 INFO [django_auth_adfs:236] end session endpoint: https://login.microsoftonline.com/88c47249-96a0-4999-aad9-838f5579a30d/oauth2/v2.0/logout
ai-pie-backend-web-1 | 2024-09-24 13:02:31 INFO [django_auth_adfs:237] issuer: https://login.microsoftonline.com/88c47249-96a0-4999-aad9-838f5579a30d/v2.0
ai-pie-backend-web-1 | 2024-09-24 13:02:31 INFO [django_auth_adfs:238] msgraph endpoint: graph.microsoft.com
ai-pie-backend-web-1 | 2024-09-24 13:02:31 DEBUG [django_auth_adfs:418] Authentication backend was called but no access token was received
ai-pie-backend-web-1 | 2024-09-24 13:02:31 DEBUG [django_auth_adfs:394] Authentication backend was called but no authorization code was received
ai-pie-backend-web-1 | 172.21.0.1 - - [24/Sep/2024:13:02:31 +0000] "POST /admin/login/?next=/admin/ HTTP/1.1" 200 5522 "http://localhost:8000/admin/login/?next=/admin/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36"
Closing this due to staleness of the issue. @a-kuchinski, I realize you expect help from this issue, but the logs and information present isn't enough here. It seems like you created a separate issue though, so perhaps we'll continue there.