lib/authlogic_connect/oauth/tokens/google_token.rb in authlogic-connect-0.0.3.4 vs lib/authlogic_connect/oauth/tokens/google_token.rb in authlogic-connect-0.0.3.6
- old
+ new
@@ -1,7 +1,10 @@
+# http://code.google.com/apis/accounts/docs/OAuth_ref.html
+# http://code.google.com/apis/accounts/docs/OpenID.html#settingup
# http://code.google.com/apis/accounts/docs/OAuth.html
# http://code.google.com/apis/accounts/docs/RegistrationForWebAppsAuto.html
+# http://www.manu-j.com/blog/add-google-oauth-ruby-on-rails-sites/214/
# http://googlecodesamples.com/oauth_playground/
# Scopes:
# Analytics https://www.google.com/analytics/feeds/
# Google Base http://www.google.com/base/feeds/
# Book Search http://www.google.com/books/feeds/
@@ -28,6 +31,11 @@
:request_token_path => "/accounts/OAuthGetRequestToken",
:authorize_path => "/accounts/OAuthAuthorizeToken",
:access_token_path => "/accounts/OAuthGetAccessToken",
:scope => "https://www.google.com/m8/feeds/"
-end
\ No newline at end of file
+ key do |access_token|
+ body = JSON.parse(access_token.get("https://www.google.com/m8/feeds/contacts/default/full?alt=json&max-results=0").body)
+ email = body["feed"]["author"].first["email"]["$t"] # $t is some weird google json thing
+ end
+
+end