salesforce-jwt-promise
Promise Based implementation of OAuth 2.0 JWT Bearer Token Flow.
- written in typescript
- returns Promise to support
async/await
syntax. - Compatible with jsforce and any other clients.
Installation
$ npm install salesforce-jwt-promise
Usage
This library contains an single export: getJWTToken()
which accepts an object with the following options object parameter:
clientId
: The salesforce connected app consumerKeyprivateKey
: The private key used to sign the certificated uploaded to the connected appuserName
: The user to impersonateaudience
: (Optional) Defaults to https://login.salesforce.cominstance_url
: (Optional) Defaults toaudience
A success response will include the following properties:
- access_token
- scope
- instance_url
- id
- token_type
; var clientId = '3MVG9A2kN3Bn17hvVNDOE5FX8c9hS...30dgSSfyGi1FS09Zg';var privateKey = ; // this should probably be encrypted! trylet jwtResp = await ; //use tokenvar sfConnection = ; sfConnection; catche console;
License
MIT
Forked from leandrob/node-salesforce-jwt