To set up OAuth you will need a Google Account.
If you do not have one, set one up - Here
-
-
Sign into Google Cloud Platform Console: https://cloud.google.com/
-
On the Dasboard click "CREATE PROJECT"
- Choose Project Name and click "CREATE"
- Click "OAuth consent screen" in APIs & Services
- Choose "EXTERNAL" and click "CREATE"
- Fill in Application Name and click "SAVE"
- On the Credentials tab click "CREATE CREDENTIALS" -> "OAuth Client ID"
- Fill in the credentials as below and hit "SAVE"
- A pop up will appear with and , these are used later
-
-
-
Log into Django admin console as superuser
- Sites -> + Add
- Domain name: http://0.0.0.0:8000 - Display name: http://0.0.0.0:8000
- Social applications -> +Add (will use keys from above)
- Provider: Google - Name: Google API - Client id: - Secret key:
-
Get SITE_ID
$ sqlite3 db4.sqlite3 sqlite> .mode column sqlite> .width 3 -20 -20 sqlite> .headers on sqlite> SELECT * from django_site; id name domain --- -------------------- -------------------- 1 example.com example.com 2 0.0.0.0:8000 0.0.0.0:8000
Set
SITE_ID=2
in .env file to match the id of 0.0.0.0:8000 in the django_site table.Now when you run the app, you will be able to login with your Google account.
-