Created
October 26, 2014 09:48
-
-
Save octatone/3401bf12535217b8d5a2 to your computer and use it in GitHub Desktop.
Fetch a Twitter api access token in using a generator function.
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
function *getToken () { | |
let options = { | |
'auth': { | |
'user': appConsumerKey, | |
'pass': appConsumerSecret, | |
'sendImmediately': true | |
}, | |
'form': { | |
'grant_type': 'client_credentials' | |
} | |
}, | |
response = yield post(tokenUrl, options); | |
return parse(response.body).access_token; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment