WPCalendars paid version allows your website visitor to send the event directly to their Google Calendar account. To use this feature, you have to configure Google Calendar API settings on your plugin.
In this step by step guide, we will walk you through how to register your website for Google Calendar API in Google API Console and configure the settings on your WordPress site.
Inside the WordPress admin dashboard, go to WPCalendars > Settings and click tab API.
Here, you’ll see fields for Google Client Secret and Google Client ID. To get the information for these fields, you’ll need to create a web application through your Google account. This doesn’t require any coding, and we’ll show you exactly what to do.
Step 1 – Navigate to Google API Console.
Step 2 – Login to Google API Console using your Google account.
Step 3 – After login, you are redirected to Google API Dashboard.
Step 4 – You need to create a project to enable Google Calendar API. Click Create button to create your application. It will redirect you to project creation page.
Provide a Project Name like “WPCalendars Project”. You can specify the project name on your own. We are creating this client id and secret key to use for WPCalendars plugin that’s why we named the project with the same name as the plugin.
Now, after project created successfully, you can enable Google Calendar API.
Step 5 – Here you need to enable Google Calendar API. Click on ENABLE APIS AND SERVICES link to enable it.
This will redirect you to all Google APIs list page. Here in the search bar, type the “Google Calendar. It will filter or search the result as the screenshot below.
Click on the first result item which is Google Calendar API.
Step 6 – After selecting the API result this will show a button to enable it. Click the button to enable Google Calendar API.
Step 7 – Now, we will generate the API credentials.
You will automatically redirect to the credential page.
Fill the form like the below to create your credentials:
- Which API are you using? – Google Calendar API
- Where will you be calling the API from? – Web server (e.g: node.js, Tomcat)
- What data will you be accessing? – User data
Click What credentials do I need? button to continue.
Step 8 – To get the OAuth Client ID you need to set up a consent screen.
Click on “Setup Consent Screen” button to setup.
Step 9 – You need to configure your consent screen, so make sure to give it a descriptive name.
Select Google Calendar API for the scopes.
Add your domain to Authorized domains and click Save button to continue.
Step 10 – Click Create credentials button and choose OAuth Client ID.
Step 11 – Now you’ll be able to finalize your credentials.
Choose “Web Application” for Application Type and be sure to give it a descriptive name like “WPCalendars”. You can find your Authorized Redirect URLs from WPCalendars > Settings > API.
Click Create button and you will find your Google Calendar Client ID and Client Secret in pop up window.
Now, you can copy and use these credentials in your plugin.