twopg / OAuth

Discord OAuth done correctly.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

2PG OAuth

Cloned from disco-oauth, but with TypeScript support, and less errors - Docs.

This package was made as a proof-of-concept and is no longer maintained. Please consider using alternatives.

Discord

Full Examples: Demo, 2PG

1 - Install

npm i -S @2pg/oauth

2 - Use

import { Client } from '@2pg/oauth';

export default new Client({
  id: '533947001578979328',
  secret: '<your_bot_secret>',
  redirectURI: 'http://localhost:3000/auth',
  scopes: ['identify', 'guilds']
});
...
const key = await client.getAccess('<code_from_discord>');
...
const user = await client.getUser(key); // { id: '...', username: 'ADAMJR', ... }
const guilds = await client.getGuilds(key); // Collection<{ id: '...', name: '2PG', ... }>

About

Discord OAuth done correctly.

License:MIT License


Languages

Language:TypeScript 100.0%