1.1.1 • Published 2 years ago
discordmfa v1.1.1
DiscordMFA
You can now provide your users with a new 2FA service. Combining your platform and a discord bot, you can now give users the ability to allow logins through discord.
Installation
Node.js 16.9.0 or newer is required.
npm i discordmfa
yarn add discordmfa
Optional packages
Example usage
const express = require('express');
const app = express();
const discordmfa = require('discordmfa');
const dmfa = new discordmfa({
token: process.env.TOKEN,
appId: process.env.APP_ID,
serverId: process.env.SERVER_ID
});
app.post('/mfa/request/:id', (req, res) => {
dmfa.send(req.params['id']); // returns void
res.json({'success': true})
})
app.post('/mfa/response/:token', (req, res) => {
const verify = dmfa.verify(req.params['token']); // returns a boolean
/* Your code here */
})
dmfa.serve();
app.listen(process.env.PORT);
Links
Contributing
Before creating an issue, please ensure that it hasn't already been reported/suggested, and double-check the documentation. See the contribution guide if you'd like to submit a PR.
Please adhere to this project's code_of_conduct.md
.
Disclaimer we are not associated with discord