This section is for the setting the environment variables used by the application for development and production and also for setting up the organizing team database for application access.
-
SESSION_COOKIE_NAME: Name of the cookie used to store the session id.
-
HOSTNAME_URL: Hostname of the application. Used for initializing redirect_uri parameter for Google OAuth2 in the app
-
GOOGLE_CLIENT_ID: Google client id for OAuth2 authentication.
- Go to Google Cloud Console
- Create a new project
- Go to APIs & Services > Credentials
- Create a new OAuth Client ID
- Select Web Application
- Add the redirect URI in the Authorized redirect URIs section. This must be the same as the HOSTNAME_URL
- Click on save and download the credentials json file
- Copy the client id from the json file and paste it in the GOOGLE_CLIENT_ID variable
-
GOOGLE_CLIENT_SECRET: Copy the client secret from the same json file and paste it in the GOOGLE_CLIENT_SECRET variable
-
FIREBASE_SERVICE_ACCOUNT:
- Go to Firebase Console
- Create a new project
- Go to Project Settings
- Go to Service Accounts
- Click on Generate new private key
- Download the json file and convert it to string
import json with open('path/to/serviceAccountKey.json') as f: data = json.load(f) print(json.dumps(data))
- Copy the string and paste it in the FIREBASE_SERVICE_ACCOUNT variable
-
FIREBASE_CONFIG:
- Create a new web app in the firebase project
- copy the config object from the firebaseConfig variable in the firebase initialization script.
- Paste it in the FIREBASE_CONFIG variable
- Go to your firebase project
- Go to Authentication
- Click on get started
- Under the "Native providers" section, click on "Email/Password" and enable it. Leave the other settings as default
- Click on "Add user" and create a new user with email and password
- Done! Now only the users with the email and password can access the application through google sign-in or email and password sign-in method