Debugging django-allauth Social Network Login Failure

后端 未结 6 1612
温柔的废话
温柔的废话 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:23

    More information is passed to the context used to render the error template but is not used in the default template.

    You can get log output by overriding the template and including in your template the following:

    {{ auth_error }}
    

    or alternatively:

    Code: {{ auth_error.code }}, Error: {{ auth_error.exception }}
    

    To override the template, add a folder to your Django template DIRS. In Django 1.8+, this looks like the following:

    TEMPLATES = [
        {
            ...
            DIRS: [os.path.join(BASE_DIR, 'templates')]
        }
    ]
    

    Then, in that folder, make directory socialaccount and put in it a file called authentication_error.html

提交回复
热议问题