Backend Infrastructure for the IITM BSc Discord
Navigate to the discord developer portal and create a new app
On the sidebar navigate to OAuth2 > General
Add http://localhost:8081/discord/auth/login/callback as the redirect URL
In the Default Authorization Link section, select custom URL from the drop down and add the same URL as above
It should look like this
On the sidebar navigate to OAuth2 > URL generator
Pick appropriate scopes, in this case identify and guilds and choose the previously added URL as the redirect
Copy the generated Redirect URL
2. Configuration Variables
Create a new file named .env and add the following
# DISCORD OAUTH DETAILS
DISCORD_CLIENT_ID = PASTE CLIENT ID
DISCORD_CLIENT_SECRET = " PASTE CLIENT SECRET"
DISCORD_OAUTH_REDIRECT = " http://localhost:8081/discord/auth/login/callback"
DISCORD_OAUTH_URL = " PASTE THE LONG GENERATED REDIRECT URL"
FRONTEND_URL = " http://localhost:8080/"
# DATABASE
DB_CONNECTION_STRING = " postgresql+psycopg2://user:password@hostname/database_name"
# SECURITY
SECURITY_KEY = " something-secret"
JWT_SECRET_KEY = " something-secret-but-for-jwt"
Make sure you set debug=False in main.py when running in prod
Install the requirements by running pip install -r requirements.txt
Run the backend with python3 main.py