nforce-express
express.js plugin for nforce. This plugin provides an express/connnect middleware factory that automatically handles the OAuth 2.0 callback from Salesforce.
Usage
Installation
npm install nforce nforce-express
var nforce = ; // load the pluginnforce; var org = nforce;
Then when your express application is set up, you can load
the middleware. The middleware listens for OAuth callbacks from
a web server flow and will automatically complete the required
POST request for an access_token
.
// add the middleware to the stackapp; // create a route to start the flowapp;
The resulting OAuth object will be stored on the session. This means that you must be using sessions in your express app!
API
express.oauth(opts)
Returns express/connect middleware for handling the OAuth callback from Salesforce.
opts:
onSuccess
: (String:Optional) A URI to the route to redirect to when the OAUth callback and POST is successfulonError
: (String:Optional) A URI to the route to redirect to when the OAUth callback and POST is not successful