This repository is meant to demonstrate how to obtain an access token using Salesforce's OAuth 2.0 JWT Bearer (Server-to-Server) Flow.
Code examples are written in JavaScript, but without the use of any library not likely available in all languages so that it might be easily implemented in any language. One possible exception is the jwt-simple library, used to create the signed JWT.
Create a file ".env" in the root directory for the environment variables with the following variables
ISS={ Consumer Key of SF Connected App }
AUD={ https://test.salesforce.com -or- https://login.salesforce.com}
SUB={ Username of connected app authorized user }
Put your 'key.pem' certificate in the directory './certificate'
npm install
node authtoken.js