Skip to content

Latest commit

 

History

History
72 lines (52 loc) · 2.32 KB

MachineAuth.md

File metadata and controls

72 lines (52 loc) · 2.32 KB

MachineAuth : SessionType

A SessionType that allows machine to machine communication between Node.js servers. This would only be used in Node.js applications. This SessionType requires a client id and a client secret, which are obtained from Auth0.

Kind: global class

new MachineAuth(sdk)

Param Type Description
sdk Object An instance of the SDK so the module can communicate with other modules

Example

const ContxtSdk = require('@ndustrial/contxt-sdk');

const contxtSdk = new ContxtSdk({
  config: {
    auth: {
      clientId: '<client id>',
      clientSecret: '<client secret>'
    }
  },
  sessionType: 'machineAuth'
});

contxtSdk.auth.clearCurrentApiToken(audienceName) ⇒ Promise

Removes an audience's API token from the in-memory token storage

Kind: instance method of MachineAuth

Param
audienceName

contxtSdk.auth.getCurrentApiToken(audienceName) ⇒ Promise

Gets the current API token (used to communicate with other Contxt APIs). Will get and store a token or use a previously acquired and stored token.

Kind: instance method of MachineAuth
Fulfills: string apiToken

Param Type Description
audienceName string The audience you wish to get an API for

contxtSdk.auth.isAuthenticated(audienceName) ⇒ boolean

Tells caller if the app is authenticated with a particular service.

Kind: instance method of MachineAuth

Param
audienceName