Skip to content
This repository has been archived by the owner on Mar 22, 2024. It is now read-only.

Failed to authenticate you for an unknown reason #450

Open
tonisoler opened this issue Apr 16, 2021 · 2 comments
Open

Failed to authenticate you for an unknown reason #450

tonisoler opened this issue Apr 16, 2021 · 2 comments

Comments

@tonisoler
Copy link

tonisoler commented Apr 16, 2021

Django Microsoft Authentication Backend version: 2.4.0
Django version: 3.1
Python version: 3.8
Operating System: Linux
Browser and version: Chrome
Description
In django admin i get an error in user authentication with and generic error: Failed to authenticate you for an unknown reason.

With debug info i only see that:
Apr 16, 2021 @ 17:03:13.096 {"asctime": "2021-04-16 17:03:13,096", "name": "django.request", "levelname": "WARNING", "pathname": "/python36/root/usr/lib/python3.6/site-packages/django/utils/log.py", "filename": "log.py", "funcName": "log_response", "lineno": 230, "message": "Bad Request: /microsoft/auth-callback/", "thread": 47168128110080, "status_code": 400, "request": "<WSGIRequest: POST '/microsoft/auth-callback/'>"}
Apr 16, 2021 @ 17:03:13.090 {"asctime": "2021-04-16 17:03:13,089", "name": "django", "levelname": "WARNING", "pathname": "/python36/root/usr/lib/python3.6/site-packages/microsoft_auth/client.py", "filename": "client.py", "funcName": "get_claims", "lineno": 153, "message": "could verify id_token sig: It is required that you pass in a value for the "algorithms" argument when calling decode().", "thread": 47168128110080}
Apr 16, 2021 @ 17:03:13.087 {"asctime": "2021-04-16 17:03:13,087", "name": "urllib3.connectionpool", "levelname": "DEBUG", "pathname": "/python36/root/usr/lib/python3.6/site-packages/urllib3/connectionpool.py", "filename": "connectionpool.py", "funcName": "_make_request", "lineno": 442, "message": "https://login.microsoftonline.com:443 "GET /XXXXxx/discovery/v2.0/keys HTTP/1.1" 200 6330", "thread": 47168128110080}
https://login.microsoftonline.com:443 "GET /XXXX/discovery/v2.0/keys HTTP/1.1" 200 6330
Apr 16, 2021 @ 17:03:13.007 {"asctime": "2021-04-16 17:03:13,006", "name": "requests_oauthlib.oauth2_session", "levelname": "DEBUG", "pathname": "/python36/root/usr/lib/python3.6/site-packages/requests_oauthlib/oauth2_session.py", "filename": "oauth2_session.py", "funcName": "request", "lineno": 469, "message": "Invoking 0 protected resource request hooks.", "thread": 47168128110080}
Invoking 0 protected resource request hooks.
Apr 16, 2021 @ 17:03:13.007 {"asctime": "2021-04-16 17:03:13,006", "name": "requests_oauthlib.oauth2_session", "levelname": "DEBUG", "pathname": "/python36/root/usr/lib/python3.6/site-packages/requests_oauthlib/oauth2_session.py", "filename": "oauth2_session.py", "funcName": "request", "lineno": 475, "message": "Adding token {'token_type': 'Bearer', 'scope': ['email', 'profile', 'openid', 'User.Read'], 'expires_in': 3599, 'ext_expires_in': 3599, 'access_token': 'ACCESS_TOKEN_CORRECT', 'id_token': 'ID_TOKEN', 'expires_at': 1618588992.0055645} to request.", "thread": 47168128110080}

Environment Setup Steps
This is using Django on a Heroku app, it's pretty standard.

Steps to Reproduce
Configure django application, and try microsoft login in admin page: The login in microsoft page end correctly, the popup close, and shows the error.

@andrewbird2
Copy link

I had the same on a recent new deploy. Downgraded pyjwt from 2.0.1 to 1.7.1 and it worked.

@ihelmer07
Copy link

I think this is related to issue #430 which isn't in the pip installed version yet.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants