Jump to content
  • 0

Node js



4 answers to this question

Recommended Posts

  • 0

In case someone is looking to connect to the CASPIO API using NodeJS, here is the code sample to get the authentication token.

const https = require('https');
const querystring = require('querystring');

const data = querystring.stringify({
	"grant_type": "client_credentials",
    "client_id": "[INSERT CLIENT ID HERE]",
    "client_secret": "[INSERT CLIENT SECRET HERE]"

const options = {
	protocol: 'https:',
	host: '[INSERT CASPIO ACCOUNT HERE].caspio.com',
    path: '/oauth/token',
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'

const req = https.request(options, (res) => {
  console.log(`statusCode: ${res.statusCode}`);

  res.on('data', (d) => {

req.on('error', (error) => {



Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...