Created
September 23, 2019 14:02
-
-
Save PamornT/7c4c883aed8cd71817d9df373bb371ae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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