Kong / mashape-oauth

OAuth Modules for Node.js - Supporting RSA, HMAC, PLAINTEXT, 2,3-Legged, 1.0a, Echo, XAuth, and 2.0
http://oauthbible.com
MIT License
1.77k stars 186 forks source link

OauthAccessToken > 400 signature invalid from Google #4

Closed jsilvestre closed 10 years ago

jsilvestre commented 11 years ago

Hello again, I'm still struggling with oauth and google :( I thought you could help me again.

    oauthCallback: (req, res) ->
        options =
            oauth_verifier: req.query.oauth_verifier
            oauth_token: req.query.oauth_token
            oauth_secret: oauthTemp.secret

        oa.getOAuthAccessToken options, (err, token, secret, result) ->
            if err?
                console.log "Error while retrieving access token: "
                console.log "#{err.statusCode}-#{err.data}"
            else
                console.log token
                console.log secret
                console.log result

oauthTemp.secret is saved in memory during the token request so the values are correctly set (checked with a console.log) Google sends me an error though:

400-signature_invalid
base_string:POST&https%3A%2F%2Fwww.google.com%2Faccounts%2FOAuthGetAccessToken&oauth_consumer_key%3Danonymous%26oauth_nonce%3DXGu9LzCsKfi7OQGJaZdUY6Hg31ke6FDy%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1375171680%26oauth_token%3D4%252Fykmunc9yFfiUSzXVt88yRlbbl2Om%26oauth_verifier%3D3kCK4GcX96CBvnNlmar56A6T%26oauth_version%3D1.0

Full code is available at https://github.com/jsilvestre/cozy-data-integrator/blob/master/server/controllers/integrator.coffee

If you can see what is wrong I'd be very grateful! Thank you in advance.