@2pg/oauth 中文文档教程
2PG OAuth
从 disco-oauth 克隆而来,但支持 TypeScript,错误更少 - 文档。
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', ... }>
2PG OAuth
Cloned from disco-oauth, but with TypeScript support, and less errors - Docs.
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', ... }>
更多
你可能也喜欢
- 7otp-boot-component 中文文档教程
- @0x-lerna-fork/map-to-registry 中文文档教程
- @104corp/cdk-aws-codedeploy-on-premises 中文文档教程
- @1057405bcltd/compute-orders-addon 中文文档教程
- @11ways/specter 中文文档教程
- @1bigh/lotide 中文文档教程
- @2alheure/vue-accordion 中文文档教程
- @2ndaddress/sa-footer 中文文档教程
- @667/ngrok-dns 中文文档教程
- @8sistemas/design-system 中文文档教程