Skip to content

RashingPro/easy-discord-oauth

Repository files navigation

❓ Info about package

🔥 100% asyncronous
🔥 Intuitive structure of methods
🔥 Fresh updates
🔥 Typescript support

📲 Installation

✅ Stable release

npm i easy-discord-oauth

📔 Using

Exchanging code

First of all, you need to receive Discord OAuth code. Navigate to Discord docs for more info
To get token use:

const tokenRes = await DiscordOAuth.exchangeCode("code", "redirect uri", "client id", "client secret");
const token = tokenRes.accessToken;

Getting user

For example, let's get info about the current user and log the username. It's requires identify scope.

const user = await DiscordOAuth.User.getCurrentUser("token");
console.log(user.username);

About

Working with Discord OAuth has never been so easy!

Topics

Resources

License

Stars

Watchers

Forks