Search code examples
djangogithubpython-social-auth

Django “python-social-auth”: HTTP 403 Client Error with github


I've followed closely this tutorial which is great. Everything worked fine until today, where when I log with github I get this error:

HTTPError at /oauth/complete/github/
403 Client Error: Forbidden for url: https://github.com/login/oauth/access_token

What am I missing / what could I have changed?


Solution

  • I'm currently developping a Website with social networks login. Everything works fine (google, facebook and twitter) but not github: after some attempts, I'm getting now a 403.

    The problem in Django is that 403 errors dont show the HTML content that come with the error!

    I had to run in Debug mode and add a breakpoint in the file

    /usr/local/lib/python3.7/site-packages/requests/models.py
    

    line 940 / where there's the code raise HTTPError(http_error_msg, response=self)

    Inspecting the variable self.content.decode("utf-8") showed me that I've been restricted (for no logical reason - what's more strange is that the same code, on my same PC but under Windows, works like a charm).

    I'm hoping the technical team at github will explain what went wrong...