Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hack to support Google's scope param #10

Merged
1 commit merged into from
Oct 31, 2010
Merged

Conversation

coopernurse
Copy link
Contributor

Hi,

Google has a non-standard 'scope' param that they require:
http://code.google.com/apis/accounts/docs/OAuth_ref.html#RequestToken

This hack allows us to pass it through if you add scope to the extraParams object passed into getOAuthRequestToken()

There's probably a more elegant way to do this, but this worked for me and I was able to login via Google.

cheers,

-- James

@ciaranj
Copy link
Owner

ciaranj commented Oct 30, 2010

Nice one, thank you, been meaning to sort this out for a while, why on earth would they not prefix it with oauth_ ? :( ... I'll pull the functionality in a bit, but I may solve it a little differently, glad you got it working, I'll have a think .. (I'll pull it into a branch so your commit appears, but I'll write a test and re-factor) .. I may go with a 'if google' approach ;)

@coopernurse
Copy link
Contributor Author

Sounds great. Thanks for writing this module. Very useful!

@ciaranj
Copy link
Owner

ciaranj commented Oct 30, 2010

even more if it now works with Google too ;) (I'm surprised, as I thought their signing order was a bit different too!)

@ciaranj
Copy link
Owner

ciaranj commented Oct 31, 2010

Ok, I'm looking at this now, it seems there's actually a bug you've un-covered here (oops!) ... in the meantime a non-patched workaround is to specify the requestUrl as something along the lines of :

  https://www.google.com/accounts/OAuthGetRequestToken?scope=http://www.google.com/calendar/feeds

rather than
https://www.google.com/accounts/OAuthGetRequestToken

Due to the bug in the way 'extra parameters' aren't sent upstream when used with a POST (as in the case with the request token) I'm perplexed how your fix works atm :) But I'll fix it shortly :)

@ciaranj
Copy link
Owner

ciaranj commented Oct 31, 2010

Ok, so I've 'pulled' your changes in, but in actual fact those changes kinda got backed out. I think you were actually experiencing a bug in the code before.

As the code currently stands in my master branch's HEAD, a client initialised as such:

 oa= new OAuth("https://www.google.com/accounts/OAuthGetRequestToken",
             "https://www.google.com/accounts/OAuthAuthorizeToken", 
             "anonymous",  "anonymous", 
             "1.0A", "http://localhost:3000/oauth/callback", "HMAC-SHA1");       

Will successfully get a request token with the following method call:

 oa.getOAuthRequestToken({"scope":"http://www.google.com/calendar/feeds"},function(error, oauth_token, oauth_token_secret, results){ });

Please can you confirm whether this solves your issue ? Cheers!

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants