Giter VIP home page Giter VIP logo

discord-oauth-worker's Introduction

Discord OAuth Worker

This is a simple Discord OAuth2 Cloudflare Worker that allows a user to authenticate with Discord, get the user information and add the user to a Discord server using Discord's API.

Prerequisites

  • Node.js and npm/yarn/pnpm installed on your system.
  • A Discord account and a Discord server.
  • A Discord application with the necessary permissions to add users to a server.

Installation

  1. Clone the repository to your local machine.
git clone https://github.com/darbyjack/discord-oauth-worker
  1. Navigate to the project directory and install the dependencies.
cd discord-oauth-worker
npm/yarn/pnpm install
  1. Navigate to src/config.ts and fill in the necessary information.
  • client_id: Your Discord application's client ID.
  • redirect_url: The URL that Discord will redirect the user to after successful authentication.
  • scopes: The scopes you would like to request from the user.
  • guild_id: The ID of the Discord server that you want to add the user to.
  1. Start the worker.
pnpm start

Usage

  1. Navigate to http://localhost:8787 in your browser to start the authentication process.
  2. The user will be redirected to Discord's authentication page.
  3. After successful authentication, the user will be redirected back to the redirect_url specified in the config.ts file.
  4. The user's information and access token will be retrieved and the user will be added to the Discord server specified in the config.ts file.
  5. The user will be redirected to the /success endpoint, where they will see a "Success!" message.

Deployment

To deploy this project to Cloudflare Workers run

  npm/yarn/pnpm run deploy

Contributing

If you would like to contribute to this project, please fork the repository and create a pull request. All contributions are welcome!

discord-oauth-worker's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

cyberflamego

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.