1

I'm working with a Django app and when I try to login with Github, this error occurs:

AuthCanceled at /oauth/complete/github/

Authentication process canceled

Request Method:     GET
Request URL:    https://my-site.com/oauth/complete/github/?code=xxxxxxxxxxxxxx&state=xxxxxxxxxxxxxx
Django Version:     3.0.5
Exception Type:     AuthCanceled
Exception Value:    Authentication process canceled

Exception Location: /usr/local/lib/python3.7/site-packages/social_core/utils.py in wrapper, line 254
Python Executable:  /usr/local/bin/python
Python Version:     3.7.2
Python Path:        ['/code',
                     '/usr/local/bin',
                     '/usr/local/lib/python37.zip',
                     '/usr/local/lib/python3.7',
                     '/usr/local/lib/python3.7/lib-dynload',
                     '/usr/local/lib/python3.7/site-packages']

I have set (correctly, I think) SOCIAL_AUTH_GITHUB_KEY and SOCIAL_AUTH_GITHUB_SECRET on my settings.py (adding https://my-site.com/oauth/ as Authorization callback URL on https://github.com/settings/applications/XXXXX).

Any idea of where is the problem?


EDIT:

I used /oauth/complete/github because previously I had had this error:

Using the URLconf defined in my-site.urls, Django tried these URL patterns, in this order: 
1. home/ 
2. login/ [name='login'] 
3. logout/ [name='logout'] 
4. oauth/
...
Palinuro
  • 184
  • 1
  • 1
  • 15
  • 1
    According to [Python-Social Github backend documentation](https://python-social-auth.readthedocs.io/en/latest/backends/github.html) your Authorization callback URL should be `http://my-site.com/complete/github/`, not `http://my-site.com/oauth/complete` – Iñigo González Jul 27 '22 at 12:06
  • Yes, that's true but I did that because I had had this error: `Using the URLconf defined in my-site.urls, Django tried these URL patterns, in this order:` `1. home/ 2. login/ [name='login'] 3. logout/ [name='logout'] 4. oauth/` – Palinuro Jul 27 '22 at 23:14
  • On the other hand, following [this post](https://medium.com/analytics-vidhya/implementing-social-login-in-django-3ba8f59ec6f2), it suppose to be `http://my-site.com/oauth/complete/github` – Palinuro Jul 28 '22 at 00:30
  • According to [Python Social Auth documentation » Exceptions](https://python-social-auth.readthedocs.io/en/latest/exceptions.html?highlight=authcanceled) the issue is not of URL rather the auth is cancelled by user. – Bhavya Peshavaria Jul 28 '22 at 08:40

0 Answers0