npm.io
1.0.3 • Published 6 years ago

sso-accesstrade

Licence
ISC
Version
1.0.3
Deps
1
Size
5 kB
Vulns
0
Weekly
0

Access-Trade OAuth2

NPM Package Version

Node.js client library for OAuth2. OAuth2 Accesstrade allows users to grant access to restricted resources by third party applications.

Usage

Install the client library using npm:

npm install --save sso-accesstrade

Create a new instance by specifying the minimal configuration

import { OAuth2AccessTrade } from 'sso-accesstrade'

const OAuth2AT = new OAuth2AccessTrade( cliendId, secret, domain, pathToken, pathAuthorization, redirect_uri? )
  • cliendId: Service registered client id. Required
  • secret: Service registered client secret. Required
  • domain: Base URL used to obtain access tokens. Required. Example: http://domain.com
  • tokenPath: URL path to obtain access tokens. Defaults to /oauth/token
  • authorizePath: URL path to request an authorization code. Defaults to /oauth/authorize

OAuth2 Access-Trade Supported Functions

Grant_type password
const token = await OAuth2AT.getTokenGrantTypePassword(username, password, scope)

// Token response:
/**
* { access_token: '1ade83d8-d07d-4c96-a8bf-14f492110bc0',
    token_type: 'bearer',
    refresh_token: '50fa1cdc-96f2-4848-b1b7-48c5555dc0fd',
    expires_in: 1547,
    scope: 'user_info' }
*/

License

SSO AccessTrade 1.0