SHIN
SHIN

Reputation: 97

How to get authorized email Id after getting authorized from google auth2 new version

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.

Upvotes: 0

Views: 107

Answers (1)

luc
luc

Reputation: 3782

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

Upvotes: 1

Related Questions