Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

chance-access-token

jonathansamines50MIT2.1.0

A simple chance mixin which generates a random access token

chance, access-token, token

readme

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

changelog

Changelog

2.1.0

Maintainance

  • #11 Use github actions instead of travis
  • #11 Add node 12 and node 14 to the test matrix
  • #11 Update to eslint v7
  • #11 Use volta instead of nvm to pin node development version
  • #11 Update development dependencies

2.0.0

Breaking Changes

  • Remove support for unmantained Node.js versions (v6 and v8) #4
  • Remove options.parseDate option in favor of options.dateFormat to support additional date formats #2

Maintainance

  • Update nyc library to v15 #5
  • Update eslint to v6 #7
  • Use ava test runner #8
  • Update date-fns library v2 #9
  • Change publishing settings to use package files and explicitly set the global registry #6 #3

1.0.0

  • Initial release