Deprecated
You can just generate the token for your own
Usage
See more detailed guides in our community
yarn add @peerboard/node-api
or
npm install @peerboard/node-api
const { generateBearerToken } = require('@peerboard/node-api');
router.post('/generate-bearer-token', auth.required, async (req, res, next) => {
const user = await User.findById(req.payload.id);
const redirect = req.redirect || "/";
const payload = {
user_id: user.id,
email: user.email,
name: user.username,
last_name: user.last_name,
avatar_url: user.image,
bio: user.bio,
tagline: user.tagline,
profile_url: '<ABSOLUTE_URL_TO_USER_PROFILE>',
role: "admin"|"member"|"banned",
};
const token = generateBearerToken(
'<YOUR_AUTH_TOKEN>',
payload,
redirect,
);
return res.json({
token,
});
});