Vap0r1ze / discord-remote-auth

Socket wrapper for discord's remote auth gateway
9 stars 3 forks source link

Discord Remote Auth

Install

npm install discord-remote-auth

Usage

const { RemoteAuthClient } = require('discord-remote-auth')
const https = require('https')
const fs = require('fs')

const client = new RemoteAuthClient()

client.on('pendingRemoteInit', fingerprint => {
  const qrCodeStream = fs.createWriteStream('code.png')
  const data = `https://discordapp.com/ra/${fingerprint}`
  https.get(`https://kissapi-qrcode.vercel.app/api/qrcode?chs=250x250&chl=${data}`, res => {
    res.pipe(qrCodeStream)
  })
  qrCodeStream.once('close', () => {
    console.log('Scan ./code.png')
  })
})
client.on('pendingFinish', user => {
  fs.unlinkSync('code.png')
  console.log('Incoming User:', user)
})
client.on('finish', token => {
  console.log('Token:', token)
})
client.on('close', () => {
  if (fs.existsSync('code.png')) fs.unlinkSync('code.png')
})

client.connect()