@mimik/oauth-helper

3.0.1 • Public • Published

Modules

oauth-helper

Typedefs

requestCallback : function

This callback is displayed as a global member.

oauth-helper

Example

const oauthHelper = require('@mimik/oauth-helper');

oauth-helper~rpAuth(type, options) ⇒ Promise

Make an authorized request.

Kind: inner method of oauth-helper
Returns: Promise - .
Category: async
Throws:

The property token may be added to options, in order to set up how the token is retrieved from the token manager. The structure is:

{
   "retry": "object to specify how the retry to the token manager will be done. similar to rp-retry retry property",
   "customerName": "name of the customer for which the token is entended for, see mST API",
   "cluster": "to set the token to be a cluster token"
}

The property metrics may be added to options, in order to setup metrics about calls made to other microservice. The structure is:

{
    "HTTPrequestDuration": "prom-client function to label and record the elapsed time",
    "url": "url to be displayed for the metrics. If not present the url of the options will be used"
}

Requires: module:@mimik/sumologic-winston-logger
Fulfil: object - Response of the request-promise request.

Param Type Description
type string Type of micro service to request.
options object Options for the request. Similar to request-promise options.

oauth-helper~authProfile(method, id, correlationId, options) ⇒ Promise

Make an authProfile request to mID.

Kind: inner method of oauth-helper
Returns: Promise - .
Category: async
Throws:

  • Promise Will throw a rich error is the request fails or an error if the id is not identified

Requires: module:@mimik/sumologic-winston-logger
Fulfil: object The response of the request made to mID.

Param Type Description
method string Method (GET, DELETE) of the request to be made.
id string UserId to associated witht the request.
correlationId UUID.<string> CorrelationId to associated with the request.
options object Options to be added to the request. metrics can then be added to the options.

requestCallback : function

This callback is displayed as a global member.

Kind: global typedef

Param Type Description
either object null or an error.

Readme

Keywords

Package Sidebar

Install

npm i @mimik/oauth-helper

Weekly Downloads

40

Version

3.0.1

License

MIT

Unpacked Size

30.6 kB

Total Files

11

Last publish

Collaborators

  • sasan.raisdana
  • miburger
  • hofachiang
  • mimik-npm-editor
  • mimikopensource