Answers for "nodejs oauth2 request"

1

nodejs oauth2 request

// this saved my ass
var request = require('request');
 
request({
  url: 'https://api.someapi.com/oauth/token',
  method: 'POST',
  auth: {
    user: 'xxx',
    pass: 'yyy'
  },
  form: {
    'grant_type': 'client_credentials'
  }
}, function(err, res) {
  var json = JSON.parse(res.body);
  console.log("Access Token:", json.access_token);
});
Posted by: Guest on February-17-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language