code: function getAccessToken(callback){
  
      console.log("Requesting access token from server...");
  
      var credentials = {
              scope: "messaging:push",
              grant_type: "client_credentials",
              client_id: CLIENT_ID,
              client_secret: CLIENT_SECRET
      }
  
      var post_data = querystring.stringify(credentials);
  
      var post_options = {
        host: "api.amazon.com",
        port: "443",
        path: "/auth/O2/token",
        method: "POST",
        headers: {
            "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8"
        }
      };
  
      var req = https.request(post_options, function(res) {
  
          var data = "";
  
          res.on("data", function (chunk) {
              data += chunk;
          });
  
          res.on("end", function() {
              console.log("\nAccess token response:", data);
              var accessToken = JSON.parse(data).access_token;
              callback(accessToken);
          });
  
      });
  
      req.on("error", function(e) {
        console.log("\nProblem with access token request: ", e.message);
      });
  
      req.write(post_data);
      req.end();
  
  }
docs: Query OAuth server for access token For more info, see: https://developer.amazon.com/public/apis/engage/device-messaging/tech-docs/05-requesting-an-access-token