Skip to content

Instantly share code, notes, and snippets.

@jhubert
Created September 24, 2012 19:43
Show Gist options
  • Save jhubert/3777908 to your computer and use it in GitHub Desktop.
Save jhubert/3777908 to your computer and use it in GitHub Desktop.
Unable to post data using OAuth
YUI().use('gallery-oauth', 'io-xdr', 'json', function(Y) {
var url = 'http://api.example.com/v1/update.json',
data = { test: 'one' },
cfg = {
method: 'POST',
data: { data: Y.JSON.stringify(data) },
xdr: { use: 'native' }
},
signedURL,
request;
function onComplete(transactionid, response, arguments) {
console.log(transactionid, response, response.responseText, arguments)
}
// Subscribe to "io.complete".
Y.on('io:complete', onComplete, Y);
Y.oAuth.ready(function() {
signedURL = Y.oAuth.signURL("key", "secret", url);
request = Y.io(signedURL, cfg);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment