Skip to content

Instantly share code, notes, and snippets.

@octatone
Created October 26, 2014 09:48
Show Gist options
  • Save octatone/3401bf12535217b8d5a2 to your computer and use it in GitHub Desktop.
Save octatone/3401bf12535217b8d5a2 to your computer and use it in GitHub Desktop.
Fetch a Twitter api access token in using a generator function.
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