I have an authenticated user and am able to query for a list of domain users using the google apis php client library.
However, it is unclear to me how I can retrieve the currently logged in user's user id. I tried using the my_customer
alias which works for the list method, but when I try to do the plain GET request with user key as my_customer
, it of course fails.
I know this must be something quite simple, but I cannot for the life of me find an answer in the documentation, so I'm pretty much reduced to guessing at this point.
For your app to work as Google Apps marketplace app, you must implement authentication using OAUTH2.
As a result you must have access to one of the following scopes which provide the APIs that get you the user Id :
https://www.googleapis.com/auth/userinfo.profile (deprecated) : Gain read-only access to basic profile information, including a user identifier, name, profile photo, profile URL, country, language, timezone, and birthdate.
https://www.googleapis.com/auth/plus.login : If using the userId value "me", this method requires authentication using a token that has been granted the OAuth scope https://www.googleapis.com/auth/plus.login or https://www.googleapis.com/auth/plus.me.