Skip to content

OAuth authorization. Setup and documentation

SergeKry edited this page Jan 12, 2025 · 12 revisions

Set Up

Current version of FORUM app supports Google and Github social authentication.

  1. Get google and github OAuth clientID and SecretKey. Or generate you own. Add social auth keys to your .env file for the backend.
GOOGLE_OAUTH_CLIENT_ID =
GOOGLE_OAUTH_CLIENT_SECRET =

GITHUB_OAUTH_CLIENT_ID =
GITHUB_OAUTH_CLIENT_SECRET =

Add social clientID keys for your react app in frontend/.env file

REACT_APP_GOOGLE_CLIENT_ID=
REACT_APP_GITHUB_CLIENT_ID=
  1. Start your application and go to 127.0.0.1:800/admin in browser

  2. Use your credentials to login OR create a superuser (optional)

  3. Find "Applications" under "DJANGO OAUTH TOOLKIT" section and hit "+Add" button

Screenshot 2025-01-12 at 23 28 22
  1. Make configuration for you application :

Caution

DO NOT SAVE APPLICATION AT THIS POINT.

Client id: do not change
User: 1
Redirect uris: leave blank
Post logout redirect uris: leave blank
Client type: Public
Authorization grant type: Resource owner password-based
Client secret: do not change
Has client secret: remove checkbox
Name: add any name (optional)
  1. COPY Client id BEFORE saving the application. And set env variable for frontend in frontend/.env file
REACT_APP_SOCIALAUTH_CLIENT_ID= <your generated client id>
  1. Save the application now.

Configuration is done. Now you can do social login from your frontend.

How it works

Clone this wiki locally