1.1.5 • Published 4 years ago
auth-discord v1.1.5
Auth-Discord for Nodejs app
Note: this package is still in beta so may be unstable.
Demo
Soon
How to use it
const {login} = require("./index.js");
// ...
// Login and get access_token:
login("CLIENT ID", "CLIENT SECRET", "identify email").then(resp => console.log(resp.access_token))
Login return :
{
"access_token": "an access token",
"token_type": "Bearer",
"expires_in": 604800,
"refresh_token": "a refresh token",
"scope": "identify"
}
GetUserInfo :
Exemple Return Result :
login("CLIENT ID", "CLIENT SECRET", "identify").then(resp => GetUserInfo(resp.access_token).then(resp => console.log(resp)))
{
id: '708717385456156716',
username: 'AndroneDev',
avatar: 'b6a852c697c339fdfd114c2164213829',
discriminator: '8964',
public_flags: 131328,
flags: 131328,
verified: true,
locale: 'fr',
mfa_enabled: true
}
Exemples
const {login, GetUserInfo} = require("./index.js");
// Method 1
login("CLIENT ID", "CLIENT SECRET", "identify email").then(resp => console.log(resp.access_token))
// Method 2
async function mylogin(){
let resp = await login("CLIENT ID", "CLIENT SECRET", "identify email")
console.log(resp.access_token)
}
mylogin()
// GetUserInfo
GetUserInfo(access_token).then(resp => console.log(resp))
// login and GetUserInfo
login("CLIENT ID", "CLIENT SECRET", "identify").then(resp => GetUserInfo(resp.access_token).then(resp => console.log(resp)))
Developed by AndroneDev