Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

passport-discord-advanced

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

passport-discord-advanced

**passport-discord-advanced**

  • 1.0.2
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

passport-discord-advanced


what is passport-discord-advanced?
passport discord advanced is a Express middleware for discord OAuth2 and OAuth wrapper with essential functions to get you started with discord's OAuth applications


Installation:

npm i passport-discord-advanced

Basic Usage

const passport_discord = require("passport-discord-advanced");
const passport = new passport_discord({
  client_id: "Your client id",
  client_secret: "Your client secret",
  scopes: ["identify", "guilds.join" /*Any others*/],
  redirect_uri: "<Your url>/callback",
  token: "The bot token", //Optional
});
const express = require("express");
const app = express();

app.get("/", passport.authenticate());
app.get("/callback", async (req, res) => {
  const auth = await passport.authenticateUser(req);
  const user = await passport.getUserData(auth.access_token); //The authed user's data
  console.log(user);
});

Add user to Guild

await passport.joinUser({
  guild_id: "The guild id",
  access_token: "The access_token", //Pass The access token
});//return GuildMember Object

Refresh Token

const refreshed_object = await passport.refresh(auth.refresh_token);//return new object with access_token and refresh_token

Contributors 📘

Made with ♥ and JavaScript By NithishCodez

FAQs

Package last updated on 21 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc