5.0.0 • Published 6 years ago
@blinkmobile/bm-identity v5.0.0
bm-identity.js

Provides easy management of authenication for our CLI via a single identity.
Getting Started
npm install @blinkmobile/bm-identity --saveconst BlinkMobileIdentity = require('@blinkmobile/bm-identity')
const tenant = 'ONEBLINK' || 'CIVICPLUS'
const blinkMobileIdentity = new BlinkMobileIdentity(tenant)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
- If set to
true, will use @blinkmobile/blinkmrc User Config to store on local file system for later use.
Logout
logout () => PromiseblinkMobileIdentity.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_KEYBLINKM_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
})5.1.0-beta.1
6 years ago
5.0.0
7 years ago
4.0.2
8 years ago
4.0.1
8 years ago
4.0.0
8 years ago
3.3.0
8 years ago
3.2.0
8 years ago
3.1.0
8 years ago
3.0.0
8 years ago
2.3.5
9 years ago
2.3.4
9 years ago
2.3.3
9 years ago
2.3.2
9 years ago
2.3.1
9 years ago
2.3.0
9 years ago
2.2.0
9 years ago
2.1.0
9 years ago
2.0.0
9 years ago
1.1.0
9 years ago
1.0.0
9 years ago