{"library":"node-salesforce-jwt","title":"node-salesforce-jwt","description":"Minimal implementation of the Salesforce OAuth 2.0 JWT Bearer Token Flow for server-to-server authentication. Version 1.1.0 is the current stable release with no recent updates (low maintenance cadence). Enables impersonating users via a connected app's private key and consumer key. Key differentiator: lightweight (no heavy SDK) and designed to integrate with jsforce by returning access_token and instance_url. No breaking changes reported; simple callback-based API.","language":"javascript","status":"maintenance","last_verified":"Sat Apr 25","install":{"commands":["npm install node-salesforce-jwt"],"cli":null},"imports":["const nsj = require('node-salesforce-jwt'); nsj.getToken(options, callback);","const nsj = require('node-salesforce-jwt');"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const nsj = require('node-salesforce-jwt');\nconst jsforce = require('jsforce');\nconst fs = require('fs');\n\nconst options = {\n  isTest: true,\n  clientId: process.env.SF_CONSUMER_KEY ?? '',\n  privateKey: fs.readFileSync('./private.key', 'utf8'),\n  user: 'admin@example.com'\n};\n\nnsj.getToken(options, (err, response) => {\n  if (err) { console.error(err); return; }\n  const conn = new jsforce.Connection();\n  conn.initialize({\n    instanceUrl: response.instance_url,\n    accessToken: response.access_token\n  });\n  conn.query('SELECT Id, Name FROM Account LIMIT 1', (err, result) => {\n    if (err) { console.error(err); return; }\n    console.log('First record:', result.records[0]);\n  });\n});","lang":"javascript","description":"Demonstrates how to obtain a JWT bearer token using a private key and connected app credentials, then use it with jsforce to query Salesforce.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}