@blinkmobile/bm-identity

Helper functions for Blink Mobiles single identity

No longer maintained
Last updated a year ago by kizaonline .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @blinkmobile/bm-identity 
SYNC missed versions from official npm registry.

bm-identity.js npm AppVeyor Status Travis CI Status Greenkeeper badge

Provides easy management of authenication for our CLI via a single identity.

Getting Started

npm install @blinkmobile/bm-identity --save
const BlinkMobileIdentity = require('@blinkmobile/bm-identity');
const blinkMobileIdentity = new BlinkMobileIdentity();

Usage

Login

If no LoginOptions are passed, a browser based login process will start. This is how users can login using a social account e.g. Google.

login (options: LoginOptions) => Promise{String}
interface LoginOptions {
  username? : String|Boolean, // Can also pass true, and username will be prompted for
  password? : String, // Will be prompted for password if username is truthy
  storeJwt? : Boolean, // Set to true to store jwt on local file system, defaults to false
  refreshToken? : Boolean, // Set to true will request a refresh token as well as an access token
}
blinkMobileIdentity.login()
  .then(jwt => {
    // Use jwt access token.
  });

storeJwt Option

Logout

logout () => Promise
blinkMobileIdentity.logout();

Get Access Token

To create an AccessToken using BlinkM Deployment Keys or retrieve the AccessToken stored after a successful login:

Using Deployment Keys

If the following environment variables are set:

  • BLINKM_ACCESS_KEY
  • BLINKM_SECRET_KEY

These will be used to create an AccessToken

getAccessToken () => Promise{string}
blinkMobileIdentity.getAccessToken()
  .then(jwt => {
    // Use access token
  });

Get Access Token Payload

Helper function to get the payload for a JWT

getPayload () => Promise{Object}
blinkMobileIdentity.getPayload()
  .then(payload => {
    // Use payload
  });

Current Tags

  • 5.1.0-beta.1                                ...           beta (3 months ago)
  • 5.0.0                                ...           latest (a year ago)

20 Versions

  • 5.1.0-beta.1                                ...           3 months ago
  • 5.0.0 [deprecated]           ...           a year ago
  • 4.0.2 [deprecated]           ...           2 years ago
  • 4.0.1 [deprecated]           ...           2 years ago
  • 4.0.0 [deprecated]           ...           2 years ago
  • 3.3.0 [deprecated]           ...           2 years ago
  • 3.2.0 [deprecated]           ...           2 years ago
  • 3.1.0 [deprecated]           ...           3 years ago
  • 3.0.0 [deprecated]           ...           3 years ago
  • 2.3.5 [deprecated]           ...           3 years ago
  • 2.3.4 [deprecated]           ...           3 years ago
  • 2.3.3 [deprecated]           ...           3 years ago
  • 2.3.2 [deprecated]           ...           3 years ago
  • 2.3.1 [deprecated]           ...           3 years ago
  • 2.3.0 [deprecated]           ...           4 years ago
  • 2.2.0 [deprecated]           ...           4 years ago
  • 2.1.0 [deprecated]           ...           4 years ago
  • 2.0.0 [deprecated]           ...           4 years ago
  • 1.1.0 [deprecated]           ...           4 years ago
  • 1.0.0 [deprecated]           ...           4 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 20
Last Month 40
Dependencies (7)
Dev Dependencies (13)

Copyright 2014 - 2016 © taobao.org |