This is a demo application that showcases an implementation of oAuth from Salesforce in Node.js.
Firstly, setup your Salesforce Org with a connected app. Remember! You will have to come back here and update your callback URL once you get it.
Before you start, make sure you've got Redis running locally. (If not, it's okay - we can wait)
Firstly, clone (or fork and clone) the App.
git clone https://github.com/adamSellers/Salesforce-oAuth-Demo.git
Change directories and install stuff
cd Salesforce-oAuth-Demo && npm install
Create the .env file
touch .env
Then add the following config vars
CLIENTID={your salesforce client id}
CLIENTSECRET={your salesforce client secret}
CALLBACKURL=http://localhost:3001/salesforce/auth
REDISSECRET={A super secret string}
REDIS_URL={your redis URL}
SALESFORCE_ENDPOINT={your salesforce login endpoint, ie https://login.salesforce.com or a community URL}
remember, head back to your connected app and update that Callback URL!
Once all that is done, you are good to go!
npm start
Then navigate to http://localhost:3001 to get started.
Once you have your app, be sure to set the following Config Vars:
- CLIENTDID: This is your Salesforce connected app client ID.
- CLIENTSECRET: This is your Salesforce connected app secret.
- CALLBACKURL: this will be https://{YOURAPPNAME}.herokuapp.com/salesforce/auth
- SALESFORCE_ENDPOINT: this is your login endpoint for SF (eg: https://login.salesforce.com or a community URL)
Then let the hapiness commence!