Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
689 views
in Technique[技术] by (71.8m points)

python - Debugging django-allauth Social Network Login Failure

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 containing more information. There is a feature request for this log output (https://github.com/pennersr/django-allauth/issues/1120) but it has been open for over a year. In the mean time, how do I get more information to debug this error?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...