如何从google auth2新版本获得授权后获得授权的电子邮件ID

I am using google API to set google calendar event by using Restful API call without using client files.

I am getting authorized and then i got access token also.

Then i need to query API with below code

POST /calendar/v3/calendars/{calendarId}/events HTTP/1.1
Host: www.googleapis.com
Content-length: 0
Content-type: application/json
Authorization: Bearer ya29.HgCGmae05QFTPB8AAAAtSjvpiRm9SE0wnfQ7umupoG8fPEKD0bk-6B_YnPQPLQ

Here the code works fine if i put email Id statically for {calendarId} . So how can i get corresponding email Id of authorized user to set it for {calendarId} ?

I am using php.

Thanks in advance.

Use the "primary" keyword as the calendarId. It will access the calendar of the authorized user.