Created
September 25, 2019 08:52
-
-
Save PamornT/c5a90c7c3f094d619f7190a4b5d1995f 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://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