1.0.2 • Published 4 years ago

action-platform-auth v1.0.2

Weekly downloads
-
License
-
Repository
-
Last release
4 years ago

Action Platform Auth Library

This library is useful to fetch Azure AD access tokens for Action Platform APIs from NodeJS command line.

Getting Started

  1. Clone the repo
  2. Navigate to the repo root
  3. npm install
  4. to run tests npm test

Installation

npm install --save action-platform-auth

Usage

Include

const actionAuth = require('action-platform-auth');

Using promise

actionAuth.fetchToken(actionAuth.TokenScope.PackageReadWriteAll)
    .then(tokenResponse => {
        console.log(`token - ${tokenResponse.token}`);
        console.log(`expiresIn - ${tokenResponse.expiresIn}`);
    })
    .catch(errorResponse => {
        console.log(`errorCode - ${errorResponse.errorCode}`);
        console.log(`errorMessage - ${errorResponse.errorMessage}`);
    });

Using async/await

try {
    var tokenResponse = await actionAuth.fetchToken(actionAuth.TokenScope.PackageReadWriteAll);
    console.log(`token - ${tokenResponse.token}`);
    console.log(`expiresIn - ${tokenResponse.expiresIn}`);
} catch (errorResponse) {
    console.log(`errorCode - ${errorResponse.errorCode}`);
    console.log(`errorMessage - ${errorResponse.errorMessage}`);
}
1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago