pennersr / django-allauth

Integrated set of Django applications addressing authentication, registration, account management as well as 3rd party (social) account authentication.

Home Page:https://allauth.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Setting SOCIALACCOUNT_ONLY = True results in template error when trying to perform a social login, "Reverse for 'account_signup' not found. 'account_signup' is not a valid view function or pattern name".

robin24 opened this issue · comments

I'm running django-allauth 0.62.1. As I don't require Email authentication in my project, I added
SOCIALACCOUNT_ONLY = True
to my settings.py.
However, when I now try logging in using my configured OAuth2 provider, I keep getting the following error:

Reverse for 'account_signup' not found. 'account_signup' is not a valid view function or pattern name.
In template /usr/local/lib/python3.12/site-packages/allauth/templates/allauth/layouts/base.html, error at line 39

Do I need to overwrite the base.html template in order to get this working again, or is there another setting somewhere that I also need to update when SOCIALACCOUNT_ONLY is set to True?

For reference, this is how the login link is defined in my own template which then leads to the error page:

Sign Up with VATSIM

Note: the VATSIM provider is a custom OAuth2 provider which I implemented myself, not one of the included providers.

Thanks for any clarifications on this, django-allauth is still pretty new to me and so this error may well be due to me not doing something right.

Do I need to overwrite the base.html template in order to get this working again

For now, yes... it is fixed in 92b47ae. But, that base template is in any case something you wouldn't want to show up in production, so I would recommend to override it in any case.

Thanks for your comment, glad to hear this has already been addressed!

Quick question, if I just want to use my own templates such as the one containing the {% provider_login_url 'vatsim' %} tag, is there actually a need for another template prompting the user to confirm the redirection to the 3rd-party login page, or can I redirect users there immediately after clicking the link? I should be able to figure this out on my own tomorrow when taking another look at the provided templates, but a pointer in the right direction would definitely be much appreciated :-).

Thanks for all your hard work on this project, implementing my own provider over the past few days was really quite straightforward once I gained a solid understanding of everything that's involved there, and gave me a really nice chance to dig into the overall workings of the OAuth2 flow.

See https://docs.allauth.org/en/latest/socialaccount/configuration.html -- specifically the note about SOCIALACCOUNT_LOGIN_ON_GET on that intermediate page.

Thanks! Missed this yesterday,
SOCIALACCOUNT_LOGIN_ON_GET = True
is exactly what I was looking for (my project doesn't handle sensitive data so I think the security trade-off is OK here).

This now works beautifully and just how I wanted, really appreciate your help! 👍