- Go to Google Cloud Console
- Create a new project or select an existing one
- Navigate to APIs & Services → Credentials
- Click Create Credentials → OAuth 2.0 Client ID
- If prompted, configure the OAuth consent screen:
- User Type: External
- App name: LearnFlow
- User support email: your email
- Developer contact: your email
- For Application type, select Web application
- Add these Authorized redirect URIs:
http://localhost:8000/accounts/google/login/callback/ http://127.0.0.1:8000/accounts/google/login/callback/ - Click Create
- Copy the Client ID and Client Secret (you'll need these)
-
Make sure your Django server is running:
python manage.py runserver
-
Create a superuser if you haven't already:
python manage.py createsuperuser
-
Go to
http://localhost:8000/adminand login -
Navigate to Sites section:
- Click on the existing site (example.com)
- Change Domain name to:
localhost:8000 - Change Display name to:
LearnFlow - Click Save
-
Navigate to Social applications → Add social application:
- Provider: Select
Google - Name:
Google OAuth - Client id: Paste your Client ID from Google Console
- Secret key: Paste your Client Secret from Google Console
- Sites: Move
localhost:8000from Available to Chosen - Click Save
- Provider: Select
The button is already configured to redirect to:
http://localhost:8000/api/auth/google/login/
However, the correct allauth URL is:
http://localhost:8000/accounts/google/login/
I'll fix this in the Login.js file.
- Navigate to
http://localhost:3000/login - Click Continue with Google
- You'll be redirected to Google's login page
- After authentication, you'll be redirected back to your app
- The user will be automatically created and logged in
Error: redirect_uri_mismatch
- Make sure the redirect URI in Google Console exactly matches:
http://localhost:8000/accounts/google/login/callback/
Error: Site matching query does not exist
- Make sure you've configured the Site in Django admin with domain
localhost:8000
Error: Social application not found
- Make sure you've added the Google social application in Django admin
- Verify the Client ID and Secret are correct