Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chance-access-token

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chance-access-token

A simple chance mixin which generates a random access token

  • 2.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

chance-access-token

npm Build Status

A simple chance mixin which generates a random access token

Installation

npm install --save chance-access-token

Usage

const Chance = require('chance');
const accessToken = require('chance-access-token');

const chance = new Chance();

chance.mixin({ accessToken });

const expiredAccessToken = chance.accessToken({
  expireMode: 'expires_at',
  expired: true,
});

// =>
// {
//   token_type: 'bearer',
//   access_token: '89D690FF-C19D-4F0E-B8E2-B1EBB3F26B0B',
//   refresh_token: '8B4361C2-4E90-4E00-B825-48C0D82F7B93',
//   expires_at: '',
// }

API

chance.accessToken(options)

  • options
    • expireMode - Can be either expires_at or expires_in. When set to expires_at it generates a token which expires at a random date. When set to expires_in it generates a token which expires in a random number of seconds.
    • dateFormat - Used when expireMode is expires_at to determine the format of the expires_at field. Can be date to generate a date object, unix to generate a UNIX timestamp in seconds since epoch or iso to generate an ISO formatted string.
    • expired - When is true and expireMode is expires_at it generates a date in the past

Keywords

FAQs

Package last updated on 14 Jun 2020

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc