Skip to content

Instantly share code, notes, and snippets.

@brittanydionigi
Last active August 29, 2015 14:16
Show Gist options
  • Save brittanydionigi/6dfaa3c2a7a4b1d2d5e9 to your computer and use it in GitHub Desktop.
Save brittanydionigi/6dfaa3c2a7a4b1d2d5e9 to your computer and use it in GitHub Desktop.
oauth
var oauth = new OAuth.OAuth(
'https://marketplace-dev.allizom.org/oauth/token', // request token URL
'https://marketplace-dev.allizom.org/oauth/authorize', // access token URL?
consumerKey, // user generated key from developers/api
consumerSecret, // user generated secret from developers/api
'1.0a', // oauth version
null, // callback
'HMAC-SHA1' // signature method
);
// once we have our oauth, then()...
oauth.getOAuthRequestToken(function(error, oauth_token, oauth_token_secret, results) {
if (error) {
console.log('error :', error) // GETTING A 500 ERROR AT THIS STAGE
} else {
console.log("Requesting access token")
oauth.getOAuthAccessToken(oauth_token, oauth_token_secret, function(error, oauth_access_token, oauth_access_token_secret, results2) {
// post to https://marketplace-dev.allizom.org/api/v2/apps/app using the oauth access token & secret
});
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment