Skip to content

Instantly share code, notes, and snippets.

@wadewegner
Last active December 28, 2015 22:18
Show Gist options
  • Save wadewegner/7570305 to your computer and use it in GitHub Desktop.
Save wadewegner/7570305 to your computer and use it in GitHub Desktop.
Simple Lua script for making a token request against the Force.com REST APIs.
local secretKey = "YOUR_SECRET_KEY"
local data = {
client_id = "YOUR_CONSUMER_KEY",
client_secret = "YOUR_CONSUMER_SECRET",
grant_type = "password",
username = "YOUR_LOGIN",
password = "YOUR_PASSWORD" .. secretKey
}
local response = http.request {
method = "POST",
headers= {["Content-Type"]="application/x-www-form-urlencoded"},
url = 'https://login.salesforce.com/services/oauth2/token',
data = data
}
local tokenResponse = json.parse(response.content)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment