Skip to content

An example express js app to handle OAuth2 with discord without passportjs.

Notifications You must be signed in to change notification settings

KrishGarg/OAuth2-Discord-ExpressJs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Discord OAuth2 with ExpressJs and Axios

This is a sample app on how you can implement discord oauth2 on the backend.

Clean Version

There is a clean version of this code in which all the comments from index.js has been removed which you can clone if you want to work with the code and not want to clean up the comments manually.

To clone just that branch, you can use degit. By using degit, it won't clone the git history and the other branches, so it will be much cleaner and quicker.

npx degit KrishGarg/OAuth2-Discord-ExpressJs#clean

Environment Variables:

Variable Default Description Required?
CLIENT_ID None Client ID of the application. Yes
CLIENT_SECRET None Client Secret of the application. Yes
OAUTH2_URL None OAuth2 URL of the application. Yes
REDIRECT_URL None {api_host}/api/discord/callback Yes
SCOPE None Scoped you want to use. Example: guilds%20identify Yes
PORT 3000 The port on which the app would listen to. No

You can get all the above constants from discord developer portal. For detailed information on the available scopes, you can checkout the discord documentation.

The index.js file is well commented/documented.


About

An example express js app to handle OAuth2 with discord without passportjs.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages