Skip to content

This repository is meant to demonstrate how to obtain an access token using Salesforce's OAuth 2.0 JWT Bearer (Server-to-Server) Flow.

Notifications You must be signed in to change notification settings

BrandonEnclude/Connected-App-Auth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Salesforce JWT Bearer Flow Example

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.

Instructions

Pre-requisites

.env

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 }

certificate

Put your 'key.pem' certificate in the directory './certificate'

Get Auth Token

npm install
node authtoken.js

Sources and Additional Information

About

This repository is meant to demonstrate how to obtain an access token using Salesforce's OAuth 2.0 JWT Bearer (Server-to-Server) Flow.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published