I am using allauth to authenticate my application with google api which is set in my Google cloud application. I am able to login successfully but after login it’s not redirecting to home page .
I am following these steps to setup my application -
Here is the error .
The requested URL /accounts/google/login/callback/ was not found on this server.
The setting ROOT_URLCONF should be as follows in your settings file: (you may have this already, but I want to make sure we’re on the same page)
ROOT_URLCONF = "myproject.urls"
Are you able to browse tot he admin page and/or get the social_app/index.html template to render at the root path? I’m trying to determine if the issue is with the allauth integration or if it’s in your general project setup.
As a note, when you share code please try to copy and paste it and apply the code formatting to it. That can be done with three leading backticks (`) and then three more backticks following the code. You can also indent the text or highlight it and select the Preformatted Text button on the WYSIWYG editor (Ctrl+Shift+C). Doing so makes it easier to read and spot mistakes that are easier for fresh eyes to find.
Hi Tim,
Thanks for trying to help me . Yes I am able to login the admin page and I am able to access index.html . Also it’s redirecting to account.google.com and after successful login , it should again redirect to index.html which is not working.
Hi saila, I hope I can help you. If the error you get is: /accounts/google/login/callback/ it means that the process is finished, but it needs a url to redirect to when the process finishes, if it returns that error it is because you have not specified a callback route.
In my projects, I have it configured as follows in ‘settings.py’:
Here my urls.py is
urlpatterns = [
path(‘’, TemplateView.as_view(template_name=“social_app/index.html”)),
path(‘admin/’, admin.site.urls),
path(‘accounts/’, include(‘allauth.urls’)),
]
During login and after sufessfully login , It has to redirect to ‘’ , here index.html
This should be solved by putting a destination in ‘LOGIN_REDIRECT_URL’. Can be you don’t have typed well the address of the callback in step 7 of the guide: http://127.0.0.1:8000/accounts/google/login/callback/
Anyway, if it returns that error, it means that it is working fine, but it doesn’t know which view to go to when it exits google authentication.