hummmingbear
hummmingbear

Reputation: 2394

Get basic profile info from google-api-client

I'm using the ruby google-api-client gem. I'm able to successfully OAuth and get back a access token. For the life of me, now that I have the token, I can't figure out how to get the basic profile info for the user.

My scope includes https://www.googleapis.com/auth/userinfo.email. How do I get this info from the client, or what google client library should I pull in to get this info?

Any help appreciated...this seems like a really simple request, yet I can't find it anywhere.

Upvotes: 3

Views: 982

Answers (1)

Iñaki Ibarra
Iñaki Ibarra

Reputation: 21

require 'google/apis/oauth2_v2'
service = Google::Apis::Oauth2V2::Oauth2Service.new
service.tokeninfo(access_token: "Your Access Token").email

Source code here

Upvotes: 2

Related Questions