8

there are oauth and oauth2 gems, but I have not found an example to connect to google with oauth

Mladen Jablanović
  • 43,461
  • 10
  • 90
  • 113
rtacconi
  • 14,317
  • 20
  • 66
  • 84
  • Duplicate of [How access Google Contacts using OpenID in Ruby](http://stackoverflow.com/questions/4324812/how-access-google-contacts-using-openid-in-ruby)? – the Tin Man Dec 14 '10 at 05:21
  • 1
    @theTinMan OAuth != OpenID, so may not necessarily be a duplicate of that. – Bob Aman Jan 30 '12 at 14:10

2 Answers2

7

The officially supported method is to use Signet. The README contains the example code required to authenticate against the Google OAuth endpoints. See also the Google API Client for Ruby. If you have any questions on either, don't hesitate to ping me. I'm supporting both libraries.

Signet will also work for other OAuth providers. An official OmniAuth plugin is also available.

Bob Aman
  • 32,839
  • 9
  • 71
  • 95
  • just out of curiosity, official to whom? I've never seen that. – Thufir Jan 24 '12 at 12:03
  • 5
    Official, as in, this is the method that Google primarily supports for accessing Google APIs in Ruby. The Google API Client uses Signet as a dependency, it was written by a Googler (me) and it's been through our security review process. Hope that clarifies things a bit. – Bob Aman Jan 30 '12 at 14:07
2

Try omniauth instead.

https://github.com/intridea/omniauth

Here's An excellent screencast showing how its used: http://railscasts.com/episodes/241-simple-omniauth

yahya
  • 101
  • 1
  • 4
  • and when I have an openid uid with google how do I extract the user's contancts. I have that one but is useless. I need an oauth object token. There is not a real solution for Ruby using OpenID+Oauth – rtacconi Dec 02 '10 at 16:44