can-pass-verify
TypeScript icon, indicating that this package has built-in type declarations

1.7.2 • Public • Published

can-pass-verify

code style: prettier Build Status codecov

can-pass-verify provides utility functions for working with the can-pass tokens.

Installation

NPM

https://nodei.co/npm/can-pass-verify.png?downloads=true&downloadRank=true&stars=true

npm install can-pass-verify

or

yarn add can-pass-verify

Features

  • get header helper
import canPass from 'can-pass-verify/lib/shares/utils';
 
const authorization = canPass.getHeaderHelper(headers, 'Authorization');
  • verify access token
  • get new access token
  • get token
import canPass from 'can-pass-verify';
import fetch from 'node-fetch';
 
// global config
canPass.config({
  canPassApi: process.env.app_can_pass_api,
  fetch,
});
 
let u = await canPass.verify(accessToken);
 
// refreshAccessToken
u = await canPass.refreshAccessToken(refreshToken, {
  client_secret: '<your client secret - never publish it>',
  client_id: '<your client id>',
});
 
// getToken
u = await canPass.getToken(
  {
    code: '<code is return from login process>',
    redirect_uri: '<redirect_uri must match with one send through login process>',
  },
  {
    client_secret: '<your client secret - never publish it>',
    client_id: '<your client id>',
  },
);

Readme

Keywords

Package Sidebar

Install

npm i can-pass-verify

Weekly Downloads

12

Version

1.7.2

License

MIT

Unpacked Size

26.5 kB

Total Files

39

Last publish

Collaborators

  • canlab