rubygems - How access Google Contacts using OpenID in Ruby -


i using devise login omniauth, authid. when user logged in

user_info:  name: riccardo tacconi last_name: tacconi email: email@gmail.com first_name: riccardo uid: https://www.google.com/accounts/o8/id?id=xxxxxxxxx provider: google_apps 

i have found plug-in: http://stakeventures.com/articles/2009/10/06/portable-contacts-in-ruby google contacts. need use method:

@client = portablecontacts::client.new "http://www-opensocial.googleusercontent.com/api/people", @access_token 

but need token. have uid. have idea how access token? there not doc accessing google.

the answer 1 complicated. pelle's portable contacts parser relies on oauth gem. might able manually construct token object (a key/secret pair) whatever omniauth/authid gives you, it's pretty messy code.

the officially supported oauth client ruby signet. however, pelle's parser designed use oauth implementation, again, story here same. might able rip out parsing code client , marry signet, before, if go down route, you've got work cut out you.

probably easiest thing today use oauth gem , accept dependency tree pelle forced on you.

edit: it's awhile later , google-api-client gem may provide need @ point. supports both oauth 1 , 2 , offers discovery-based access certain google apis in many cases. unfortunately contacts api not on list client still capable of making requests apis without using discovery, though it's bit more manual in case (in need pass http requests authorize , you're on own parsing).


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -