Skip to content

Google Oauth Configuration.

TS Tamarai Selvan edited this page Mar 21, 2023 · 1 revision

Welcome to the Base Django project Setup wiki!

In this wiki, we are going to see about the configuration needed to Log in with Google in the project. I am using GCP (Google Cloud Platform), for the configuration.

Note: TO do this configuration that Gmail account should be having access to the GCP console

Step 1: Go to your Manage Google account Google Cloud Console.
Step 2: Press / in your keyboard and type create project in the search bar. Click Create Project.
Step 3: Enter Project name and click create.
Step 4: Navigate to Api's & Services Section.
Step 5: Under Api's & Services, navigate to OAuth Consent screen in the sidebar.
Step 6: Click External, and click create. Enter the details as follows:

Enter App Name: < Your app name >
User Supported Email: < Select the Email address >
Fill Email under developer contact information : < your Email address >

Note: Other fields are optional.

Step 7: Click next ⇾ Next ⇾ After completion, click back to dashboard.
Step 8: Under Api's & Services, navigate to Credentials in the sidebar.
Step 9: Click on New Credentials and click on OAuth Client ID
Step 10: Select Application type as: Web Application, and Enter the details as follows:

Under authorized JavaScript Origins, add 2 request URL:

URIs 1: http://localhost:8000
URIs 2: http://127.0.0.1:8000

Under authorized Redirect URIs, add 2 request URL:

URIs 1: http://localhost:8000/social-auth/complete/google-oauth2/
URIs 2: http://127.0.0.1:8000/social-auth/complete/google-oauth2/

image

Step 11: Click Save.
Step 12: It will show a Client ID & Client Secret. Copy to your clipboard.
Step 13: Go to Settings.py and navigate to Google Authentication Keys. Type details as follows:

SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = < Paste your Client ID > SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = < Paste your Client secret >

Note: Once after completing these Steps, You will Able to log in to your account with Gmail account. Open website in http://localhost:8000 (recommended).

Clone this wiki locally