11-17-2020, 04:54 PM
You need a Google Application so that you can get API keys through which you can make API calls. If you have an existing Google Application you can use that, just make sure that you enable Calendar API. If you don't have an existing Google Application follow the below steps to get one :
Go to Google API Console
Create a project by clicking "Select a project" (at the top), and then clicking on the "+" button in the dialogbox. In the next screen enter your project name, and agree with the Terms and Conditions
After the project is created, select the created project from the top dropdown.
Click the Library tab on the left. Search for "Calendar API" and enable it.
By enabling "Calendar API", your Google application can get access to the user's Calendar.
Now click on Credentials tab on the left. In the next screen click on "OAuth consent screen". Fill out the mandatory fields. Save it.
Now click on the "Credentials" tab (just beside "OAuth consent screen"). In the screen, click on "Create credentials". Choose "OAuth Client ID" as the type.
In the next screen fill out the name. The Application type should be "Web application"
Add a redirect url in the section Authorized redirect URIs. This url should point to your redirect url script. A redirect url is the url where Google redirects the user after he authorizes your Google Application.
You can even add a localhost url if you want.
If you are using the attached codes in this tutorial, the redirect url should point to google-login.php (give the full url)
You can leave out Authorized JavaScript origins as blank. Click on the Create button.
On success you will get the App Client ID and App Secret. Save those as they will be required later.
Go to Google API Console
Create a project by clicking "Select a project" (at the top), and then clicking on the "+" button in the dialogbox. In the next screen enter your project name, and agree with the Terms and Conditions
Click the Library tab on the left. Search for "Calendar API" and enable it.
By enabling "Calendar API", your Google application can get access to the user's Calendar.
Now click on Credentials tab on the left. In the next screen click on "OAuth consent screen". Fill out the mandatory fields. Save it.
Now click on the "Credentials" tab (just beside "OAuth consent screen"). In the screen, click on "Create credentials". Choose "OAuth Client ID" as the type.
In the next screen fill out the name. The Application type should be "Web application"
Add a redirect url in the section Authorized redirect URIs. This url should point to your redirect url script. A redirect url is the url where Google redirects the user after he authorizes your Google Application.
You can even add a localhost url if you want.
If you are using the attached codes in this tutorial, the redirect url should point to google-login.php (give the full url)
You can leave out Authorized JavaScript origins as blank. Click on the Create button.
On success you will get the App Client ID and App Secret. Save those as they will be required later.