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

Single user access to analytics API #13

Closed
devth opened this issue Mar 19, 2012 · 14 comments
Closed

Single user access to analytics API #13

devth opened this issue Mar 19, 2012 · 14 comments

Comments

@devth
Copy link

devth commented Mar 19, 2012

I've read the docs on Getting an OAuth2 Token but that only seems appropriate when your app needs to authenticate for the current user. In my case I just need to access my own analytics.

Twitter describes this: https://dev.twitter.com/docs/auth/oauth/single-user-with-examples

Is there a way to do this with legato, or else use Google's Simple API Access with an API key?

@tpitale
Copy link
Owner

tpitale commented Mar 19, 2012

I do have a local branch to do this. I'm a bit busy this week, but I'll try to get that up and integrated soon!

@devth
Copy link
Author

devth commented Mar 19, 2012

Awesome, thanks! 🍺

@tpitale
Copy link
Owner

tpitale commented Mar 19, 2012

Can you check out this branch: https://github.com/tpitale/legato/tree/oauth-1-support It allows you to use oauth with an API key, and hang onto that token forever without having to refresh it. This was how I did single user support in my own stuff.

Check out the Rakefile for a way to get a new token.

I'm not sure if this is entirely what you're looking for, and it certainly needs better integration, tests, and documentation. But it might get you started.

@devth
Copy link
Author

devth commented Mar 20, 2012

I was able to get an oauth verification code using your code from Rakefile. Do I use that to create a Legato::User?

@devth
Copy link
Author

devth commented Mar 20, 2012

I think I figured it out. After manually retrieving the Token/Secret, I just create an access token in with those saved values:

def access_token 
  OAuth::AccessToken.new(consumer, token, secret)
end

@user = Legato::User.new(access_token, api_key)

Thanks for your help.

@devth
Copy link
Author

devth commented Mar 20, 2012

Filtering on this branch must not match the docs right? Does this use the previous method of filtering from Garb?

@devth
Copy link
Author

devth commented Mar 20, 2012

Nvm, just saw that oauth-1-support is up-to-date with master. I'll keep messing with it.

@devth
Copy link
Author

devth commented Mar 26, 2012

Got this working. Thanks!

@devth devth closed this as completed Mar 26, 2012
@nfriend21
Copy link

Trying to get this working too....do you have any tips? I can only get it working if I continue to re-authorize my account and get a current token. I just want to use the api key. How can I do this? thanks!

@salgadobreno
Copy link

I'm trying to set up this type of access too, any tips?

@tpitale
Copy link
Owner

tpitale commented Sep 29, 2013

As far as I'm aware, Google has disabled access via oauth 1. OAuth 2 is the only thing available. You can, however, get a service account: https://github.com/tpitale/legato/wiki/OAuth2-and-Google#service-accounts

@amiel
Copy link

amiel commented Mar 18, 2014

FYI: Service accounts only work for Google Apps accounts. Since we were using a regular @gmail.com google account, we went with an "Installed Application". And to streamline the process, we wrote this poorly named gem (google-oauth2-installed). I hope it helps someone :)

@tpitale
Copy link
Owner

tpitale commented Mar 18, 2014

Cool, if you open an issue I'll add it to the wiki so people can find it. Thanks!

On Mar 18, 2014, at 2:08 PM, Amiel Martin notifications@github.com wrote:

FYI: Service accounts only work for Google Apps accounts. Since we were using a regular @gmail.com google account, we went with an "Installed Application". And to streamline the process, we wrote this poorly named gem (google-oauth2-installed). I hope it helps someone :)


Reply to this email directly or view it on GitHub.

@amiel
Copy link

amiel commented Mar 18, 2014

@tpitale Will do, thanks!

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

No branches or pull requests

5 participants