This article describes the step-by-step process of generating an Access token for the Google OAuth 2.0 Connection for the webMethods.io.
- User needs to have a working Google account, to log into the google cloud console. Sometimes it's required paid tenant depending on the charges applicable on the API.
- Access permission for Google APIs.
- Working webMethods.io Integration cloud tenant.
- How to generate an Access token for the Google APIs for the OAuth 2.0 Authorization and establishing a connection in webMethods.io
Any coding or configuration examples provided in this document are only examples and are not intended for use in a production system without verification. The example is only done here to better explain and visualize the possibilities.
1. Log in to the Google cloud console(https://console.cloud.google.com), with the Google credentials. It will look like below.
2. Users can create a new project or existing projects can be used. In this case, the existing project has been used.
3. Now enable the Google pub/sub API for the newly created project or in an existing project. So, click on hamburger_button -> APIs & Services -> Dashboard.
4. The dashboard will appear for APIs & Services. Now click on the “ENABLE APIS AND SERVICES”.
5. It will take the user to the “API Library”. A search bar will appear, users need to search for the particular API’s, that he needs to activate for this project.
6. Let's take Google Pub/Sub for this example and we will generate the access token for the same. Search for the Google pub/sub APIs. select and enable It.
7. Once the APIs are enabled successfully, It looks like the below screenshot.
8. Now the Google pub/sub APIs are enabled successfully for the selected project. Now we will proceed for Obtaining the Access token for the Pub/Sub OAuth 2.0 Authorization.
9. To generate the OAuth 2.0 Access_token for any google APIs, the user needs to generate the “client_id” & “client_secrets” first. Navigate to the “API & Services” and click on the “Credentials”. On the page choose the “Create Credentials” dropdown and select the “OAuth client ID”.
10. The next page is asking for the details of “Create OAuth client ID”, choose the “WebApplication” under the Application type and provide the Name of the Application (any name). provide the redirect URI: https://developers.google.com/oauthplayground/ and click on the “create” button.
11. The next page contains information about the “client_id” & “client_secret”. Note down these details as we need these credentials for the generation of the Access_token.
12. Now, we have generated all the necessary credentials for the OAuth 2.0 Authorization from the google cloud console. Now we will navigate to Google’s “OAuth 2.0 Playground”.
13. Now, click on the link: https://developers.google.com/oauthplayground/ Google’s OAuth 2.0 playground will open, here click on the “setting” button and provide your “client_id” & “client_secret” as mentioned in the below screen-shot and click on the close button.
14. Now, search for the Google Pub/Sub API and click on their respective scopes and click on the “Authorize” button.
15. Next page will ask for granting the permission for the scopes, click on the “Allow” button.
16. It will redirect you again in the “OAuth 2.0 playground” page. Now click on the “Exchange authorization code for tokens” and it will give you the “access_token” as well as the “refresh_token”. The validity of these tokens is around “3600 seconds” i.e- Approximately 1 hour.
17. Now, the user can use these “access_token” & “refresh_token” in webMethods.io integration cloud tenant to make a connection for the Google Pub/Sub connector. Now log into the webMethods.io tenant and create a workflow. Inside the workflow drag the Google Pub/Sub app from the menu and click on the “setting” button.
18. Choose the action from the predefined operation drop-down menu and click on the “+” sign to configure the new connection.
19. Fill all the necessary credentials details and click on the Save button.
20. Now, save this connection and let do the dry run while running one operation “create topic”. So the integration runs successfully, below is the graphical view for the same.
21. User can see the output in the console as well.