Debugging django-allauth Social Network Login Failure

后端 未结 6 1629
温柔的废话
温柔的废话 2020-12-11 06:43

When using django-allauth to do an OAuth login via a social provider, sometimes it fails with the error page \"Social Network Login Failure\". There is no log output contai

6条回答
  •  孤街浪徒
    2020-12-11 07:15

    When I was testing locally, my problem was two fold: First, I had to make sure that I started the server using

    python manage.py runserver localhost:8000
    

    Then, in the admin page I had to make sure the Sites table had an entry for localhost:8000, e.g. at

    http://localhost:8000/en/admin/sites/site/
    

    The gotcha for me was that I'd had multiple attempts at this and the result was the the ID for my localhost:8000 Sites table entry had become greater than 1. You'll notice in the allauth documentation that is says to to have SITE_ID = 1 in the settings.py but if you inadvertently create a different ID for the entry, you'll have to either alter the database entry's ID or change SITE_ID value.

    The other issue I had (unrelated to the poster's issue) was that I also had old registrations url template include interfering with the allauth ones.

提交回复
热议问题