How to get user country and timezone information from Google OAuth2 PHP Client -
i'm using php google api client library retrieve user information google account using oauth2. however, despite google's documentation states, can not seem access user's country or timezone information though token returned , other information can obtained userinfo.profile
scope.
i used example code provided int heir library here , if var_dump($user)
on line 49 of file following output (with redaction privacy concerns):
array(10) { ["id"]=> string(21) "123" /* redacted */ ["email"]=> string(13) "xxx@gmail.com" /* redacted */ ["verified_email"]=> bool(true) ["name"]=> string(14) "sherif ramadan" ["given_name"]=> string(6) "sherif" ["family_name"]=> string(7) "ramadan" ["link"]=> string(27) "https://plus.google.com/xxx" /* redacted */ ["picture"]=> string(0) "https://lh3.googleusercontent.com/-xxx-zs/aaaaaaaaaa/aaaaaaaaa/cmbwzmldyqm/photo.jpg" /* redacted */ ["gender"]=> string(4) "male" ["locale"]=> string(2) "en" }
as can see no timezone or country information available. i've tried various scopes such https://www.googleapis.com/auth/plus.login
, https://www.googleapis.com/auth/plus.me
, https://www.googleapis.com/auth/userinfo.email
, https://www.googleapis.com/auth/userinfo.profile
, , https://www.googleapis.com/auth/userinfo
, no luck. seem provide same result.
i've ensured as session/cache , other aspects not factor. renewing auth tooken. nothing works.
anyone insight on how retrieve information through google api client library php great help.
the google calendar api -> calendarlist -> list method returns users calendar time zone use. agree, time zone should part of plus->people->get.
docs at: https://developers.google.com/google-apps/calendar/v3/reference/calendarlist/list
Comments
Post a Comment