3

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.

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
hummmingbear
  • 2,294
  • 5
  • 25
  • 42

1 Answers1

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

Source code here

  • embed the link using markdown and add a meaningful word. It will look good and also meaningful [check here](https://stackoverflow.com/editing-help#comment-formatting)... Like this – Shashank Gb May 07 '21 at 18:49