Skip to content

Instantly share code, notes, and snippets.

@PamornT
Created September 25, 2019 08:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PamornT/c5a90c7c3f094d619f7190a4b5d1995f to your computer and use it in GitHub Desktop.
Save PamornT/c5a90c7c3f094d619f7190a4b5d1995f to your computer and use it in GitHub Desktop.
let promise_token = new Promise(resolve => {
var options = {
method: 'POST',
uri: 'https://trackwebhook.thailandpost.co.th/post/api/v1/authenticate/token',
strictSSL: false,
headers: {
'Content-Type': 'application/json',
'Authorization': 'Token ' + config.thaipost.token
}
};
request(options, function(error, response, body) {
resolve(JSON.parse(body));
});
});
let access_token = await promise_token;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment