Created
September 1, 2011 16:41
-
-
Save bytespider/1186612 to your computer and use it in GitHub Desktop.
jsOAuth xAuth boilerplate
This file contains hidden or 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
var oauth = OAuth({ | |
consumerKey: 'MY-CONSUMER-KEY', | |
consumerSecret: 'MY-CONSUMER-SECRET' | |
}); | |
oauth.post('https://api.twitter.com/oauth/access_token', { | |
'x_auth_username': 'DarthVader', | |
'x_auth_password': 'Luk3i5myS0n', | |
'x_auth_mode': 'client_auth' | |
}, successCallback, failureCallback); | |
function successCallback(response) | |
{ | |
// contain within is a token of joy | |
var token = oauth.parseTokenRequest(response.text); | |
var tokenKey = token.oauth_token; | |
var tokenSecret = token.oauth_token_secret; | |
oauth.setAccessToken(tokenKey, tokenSecret); | |
// launch the rest of my application | |
app.nowHasTokenCode(); | |
} | |
function failureCallback(response) | |
{ | |
console.error('Something bad happened', response.text); | |
} |
Yes I believe it should still work unless twitter has changed something
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is this still relevant? I can't make it working.