Skip to content

express server for oauth2 authentication via discord & signature validation

License

Notifications You must be signed in to change notification settings

glue-org/glue-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

glue-logo-wide

development 👷‍♀️

prerequisites

  • node v18.3.0

  • mongodb

  • .env file with the following entries:

    • DISCORD_OAUTH_CLIENT_ID

    • DISCORD_OAUTH_SECRET

      • the applications client secret
    • DISCORD_CALLBACK_URL

      • the callback url specified in your oauth2 url
    • DISCORD_TOKEN

      • your discord bots token
    • PORT

      • the port on which the server will listen
    • SESSION_SECRET

    • MONGO_URL

      • a connection string to the mongodb database
      • if authentication is needed, make sure the connection string has the right format, e.g. mongodb://myusername:mypassword@127.0.0.1:27017/glue_discord?authSource=admin
        • the authSource parameter is necessary to authenticate against the admin database
        • make sure you avoid special characters in the password as it leads to annoying complications
    • BACKEND_CANISTER_ID

      • the canister id of the glue backend canister, use the local canister id when developing and a canister from the mainnet when deploying to production
    • HOST

      • in a node environment we have to specify a host for the agent to work, use the hostname of your local deployment ofthe glue frontend for development and https://ic0.app for production
    • NODE_ENV

      • development for development and production for production

local deployment

  • run yarn install to install all dependencies
  • make sure the local deployment of glue is running
  • run yarn start:dev to run a development nodemon server (make sure your node version is correct, run nvm use if in doubt)

deploying to production

  • run yarn build to build the express server
  • you can then use something like pm2 to deploy the server to production
  • to make the express server listen to incoming request to your server, expose it using a nginx reverse proxy

    ⚠️ when using nginx reverse proxy: make sure you set the correct proxy headers for nginx and trust proxy setting for express like here!

About

express server for oauth2 authentication via discord & signature validation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published