Skip to content

Instantly share code, notes, and snippets.

@jamesnicholls
jamesnicholls / index.js
Last active February 6, 2020 17:09
Example of getting Salesforce access token using JWT bearer flow
const jwt = require('jsonwebtoken');
const {
SALESFORCE_CLIENT_ID,
SALESFORCE_AUTH_KEY,
SALESFORCE_USERNAME,
SALESFORCE_AUTH_HOST,
} = process.env;
function async getSalesforceAuthData() {
@jamesnicholls
jamesnicholls / gist:086aaf41d55e2ba265ac
Created December 16, 2014 13:27
Multi-environment module pattern
// function will execute immediately
(function(root, factory) {
if (typeof exports === 'object') {
// commonjs
module.exports = factory(
// pass dependencies via require
);
} else if (typeof define === 'function' && define.amd) {
// amd
define([