bytespider / jsOAuth

JavaScript implimentation of the OAuth protocol. Currently supports version 1.0 (RFC5849) of the specification. Node.js & CommonJS compatible.
http://bytespider.github.com/jsOAuth/
MIT License
557 stars 109 forks source link

callbackUrl #12

Closed lucassouza1 closed 13 years ago

lucassouza1 commented 13 years ago

Only oob is available. create an option to callback url and use it on headerParams

headerParams = { 'oauth_callback': oauth.callbackUrl, // 'oob' - Make it flexible 'oauth_consumer_key': oauth.consumerKey, 'oauth_token': oauth.accessTokenKey, 'oauth_signature_method': oauth.signatureMethod, 'oauth_timestamp': getTimestamp(), 'oauth_nonce': getNonce(), 'oauth_verifier': oauth.verifier, 'oauth_version': OAUTH_VERSION_1_0 };

bytespider commented 13 years ago

I've added callbackUrl to the options as per your suggestion. Its currently on https://github.com/bytespider/jsOAuth/tree/callback_url_issue12 branch. I'll bring this into master and generate a new version at the end of the week

lucassouza1 commented 13 years ago

Thanks!

bytespider commented 13 years ago

V1.1 in the downloads section now.

Ridermansb commented 12 years ago

Hello again @bytespider

I'm having problems with callbackurl.

Define my OAuth object as follows:

 OAuth({
        consumerKey: servXML.attr("appKey"),
        consumerSecret: servXML.attr("appSecret"),
        requestTokenUrl: servXML.attr("request_token"),
        authorizationUrl: servXML.attr("authorize"),
        accessTokenUrl: servXML.attr("access_token"),
        callbackUrl: "http://ridermansb.kodingen.com"
    });

Authentication

oauthObj.fetchRequestToken(openAuthoriseWindow, failureHandler);

Callback success function for fetchRequestToken

openAuthoriseWindow = function(url) {
    window.open(url, "authorise", "width=850,height=550,toolbar=no,resizable=yes,scrollbars=yes");
}

Problem

I'm trying to consume the Dropbox API. After the authentication URL is returned:

_https://www.dropbox.com/1/oauth/authorize?oauth_token_secret={XXX}&oauth_token={XXX}_

Before allow Before allow

After allow After allow

Apparently that was not called calbackurl

Am I doing something wrong? What do you suggest?

Note: Using the Twitter API, everything works perfectly!