Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get details of current user from Google APIs

Tags:

google-oauth

I am sure that I am being very blind or stupid somewhere along the way but I have looked for this answer for a while and haven't come up with anything!

I have been working on getting my actionscript app working with Google's Oauth mechanisms which is all working great now but I can't for the life of me work out how to get details on the currently logged in user.

I want to get get the user's name (alias or full name I don't care) and a thumbnail url to display at the top of my app to make it clear who is logged in.

I have looked in general google api docs, drive docs and youTube docs and not found it anywhere...

I'm sure this is a really easy answer for someone to give!

Thanks

like image 348
Roaders Avatar asked Sep 20 '25 18:09

Roaders


1 Answers

Add this to the scope - https://www.googleapis.com/auth/userinfo.profile

And after authorization is done, get the information from - https://www.googleapis.com/oauth2/v1/userinfo?alt=json

It has loads of stuff - including name, public profile url, gender, photo etc.

Source : Get user info via Google API

like image 119
Vignesh Kumar A Avatar answered Sep 23 '25 12:09

Vignesh Kumar A