Socket
Socket
Sign inDemoInstall

@peerboard/node-api

Package Overview
Dependencies
15
Maintainers
2
Versions
19
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @peerboard/node-api

Deprecated use https://community.peerboard.com/post/183197627


Version published
Weekly downloads
32
decreased by-41.82%
Maintainers
2
Install size
294 kB
Created
Weekly downloads
 

Readme

Source

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');

// Don't forget to protect your endpoint with auth
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, // Required unique user id - should not change(email is bad identifier)
    email: user.email, // Email is required
    name: user.username, // If empty user will be asked to enter her name
    last_name: user.last_name, // You can also specify last name and enable require last name in community settings
    avatar_url: user.image, // Optional url to photo
    bio: user.bio, // Optional
    tagline: user.tagline, // Optional
    // It is possible to use custom profile url into your app.
    // We will substitute all urls to user profile with this.
    // Optional
    profile_url: '<ABSOLUTE_URL_TO_USER_PROFILE>',
    role: "admin"|"member"|"banned", // Is optional by default member on creation
  };
  const token =	generateBearerToken(
    '<YOUR_AUTH_TOKEN>',
    payload,
    redirect,
  );
  return res.json({
    token,
  });
});

Keywords

FAQs

Last updated on 13 Oct 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc