-
Notifications
You must be signed in to change notification settings - Fork 48
-
Notifications
You must be signed in to change notification settings - Fork 48
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
Authentication fails? #80
Comments
Sorry I submitted that before entering text. Trying again. I am following: https://github.com/tpitale/legato/wiki/OAuth2-and-Google Everything goes well until I get to access_token = client.auth_code.get_token(ENV['LEGATO_OAUTH_AUTH_CODE'], :redirect_uri => 'http://localhost') where I get the error: OAuth2::Error: invalid_grant:
{
"error" : "invalid_grant"
} I confirm that |
p.s. I also tried first adding the email address provided by Google API web console to the Google Analytics approved users, but still get the same |
Did you do the steps above the code where you get the url with the code in it from google and set the |
Yup, tried that. |
The only other thing I can think of offhand is that your oauth client id/secret is not set properly for analytics.readonly scope? |
The code is only a single use code to get you the token. And the token itself expires after as little as 30 minutes. |
You can try using the |
Very strange. The command line tool works fine for me. I get a token, I However, using that LEGATO_OAUTH_AUTH_CODE with the example code for On Mon, Aug 4, 2014 at 1:29 PM, Tony Pitale notifications@github.com
Carl Boettiger |
My guess is there is a typo somewhere. Maybe in your code, maybe in the wiki, maybe in the way your ENV variables are being set. |
I'm facing this same problem, exactly as @cboettig said. Every time I have to get a new token so I continue testing. |
I'm able to run the wiki code. Do you have the correct settings in google to enable analytics access for your oauth info? |
I think so because I can see my GA data, but just at first request, refreshing the page I get this error:
My code is exactly as wiki. For every request I have to hit the address on browser to copy the new auth code. |
That code is a single use. You get an access token with it. That access token may be used for 30 minutes before needing refreshing. I would advise reading up on how to use OAuth 2. This is not a Legato issue. The wiki is only a short primer. |
I've updated the wiki: https://github.com/tpitale/legato/wiki/OAuth2-and-Google To add more caveats about how this is not a definitive guide to OAuth 2, and how you need to understand how that process works before using any tool that works with Google (or any of the many other services that auth using OAuth 2). |
No description provided.
The text was updated successfully, but these errors were encountered: