Skip to content

Instantly share code, notes, and snippets.

@PamornT
Created September 23, 2019 14:02
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/7c4c883aed8cd71817d9df373bb371ae to your computer and use it in GitHub Desktop.
Save PamornT/7c4c883aed8cd71817d9df373bb371ae to your computer and use it in GitHub Desktop.
let promise_token = new Promise(resolve => {
var options = {
method: 'POST',
uri: 'https://trackapi.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