How to Configure Google API in Magento 2

Social login is popular among customers due to a faster registration process (almost no additional information is needed), and you can save the time of remembering all your accounts. However, before creating a social login in Magento 2, you have to connect to the API of other social networks such as Google, Facebook, Yahoo, Instagram, Pinterest, etc. Today, we will show you how to configure Google API in Magento 2.

When entering Twitter, you need to create an external application to connect your website to Google API. Then, application ID and secret (Client ID and secret or API ID and Secret), or application credentials, are all that we need. With this external application, your website will be linked to API. And these credentials play an important role in making Google users get access to your website.

To Configure Google API, let’s follow these steps:

1. Firstly, let’s enter // and sign in your Google account. We start to configure Google API in Magento 2 here.

Configure Google API in Magento 2

2. Then, on the Dashboard sidebar, choose Credentials tab which is on the left side, and click Create button to create a new project.

3. Fill in all the fields like project name, and choose Yes for two fields below, then click Create.

Configure Google API in Magento 2

4. After clicking Create button, wait for a minute, choose the tab OAuth consent screen beside Credentials Tab, and then fill in all the information about your website or your product such as Product name, Home page URL, Product Logo URL, etc. After that, press Save.

Configure Google API in Magento 2

5. In the Tab Credentials, click Create Credentials then choose OAuth Client ID.

Configure Google API in Magento 2


On the Create Client Field, choose Web Application as your application type. Next, you continue to fill information of name and restrictions. Remember to put your website domain as a requirement to match with the current host name in the Authorized JavaScript origins field.

6. After creating client ID, a pop-up showing your client ID and client secret will appear like the image below.

Configure Google API in Magento 2

7. Now, after getting your Client ID and secret, copy and paste them into API fields in Magento 2 back-end interface as an admin.

Configure Google API in Magento 2

In this post, we have shown you how to configure Google API in Magento 2. Follow us if you want to know how to do the same with other social networks’ APIs!



Don't want to miss out on our latest insights?
Subscribe to our newsletter.

Disclaimer: By clicking submit, you agree to share your information with us to receive news, announcements, and resources when they are available.