This serves as a PoC to demonstrate how a NodeJS app can be setup to integrate with the Salesforce REST API
- Clone repo (along with submodule) by running
git clone --recursive https://github.com/scottbcovert/sf-nodejs-integration-poc
- Run
npm install
- Create a connected app in your Salesforce org
- Set the OAuth scope for your connected app to include
full
,refresh_token
, &offline_access
- Set your Callback URL to be
http://localhost:5000/oauth2/callback
- Copy the contents of the
.env.sample
file into a local.env
file, replacing theCLIENTID
&CLIENTSECRET
values with your connected app's consumer key and secret - To integrate with a Salesforce sandbox change the
URL
value tohttps://test.salesforce.com
- Run
npm start
from the root directory to start up the server - In a new terminal window run
cd client && npm install && npm run build && npm start
from the root directory to start up the client - The app should start running in
localhost:3000
- Setup Heroku CLI
- Run
heroku create
- Run
git push heroku master
- Run
heroku config:set CLIENTID=*YOUR_CONSUMER_KEY* CLIENTSECRET=*YOUR_CONSUMER_SECRET* REDIRECTURL=https://*your-heroku-instance*.herokuapp.com/oauth2/callback SECRET=*YOUR_COOKIE_SECRET*
- Update your Salesforce connected app's Callback URL list to include
https://your-heroku-instance.herokuapp.com/oauth2/callback
- To integrate with a Salesforce sandbox run
heroku config:set URL=htps://test.salesforce.com
This project is licensed under the MIT License - see the LICENSE.md file for details