Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
This tutorial was originally written in 2014 for my website. Although the Google screenshots may be slightly out of date and I wrote this using version 5.5.1 of Talend, you should still be able to make use of this. I have attached a copy of the job and a copy of the parameters file I used for this.
Google make use of the OAuth 2.0 protocol for authentication for (I think, but am happy to be corrected) all of their services. They do a pretty good job of describing the protocol. Once you have read through the documentation you should have a better idea of what you are doing, which should make this easier. The Google documentation is here.
The first thing that needs to be done is to create a Google Project. This is described below....
Create a Google Project
I juste found this in the palette tGoogleDriveConnection
Maybe this can be easier
It's a Drive connection but I think it will work with other apis from Google, I'll need time to test it
Hi @rhall
Thanks for this helpful tutorial,
I have a probelem that when i get the bearer from Trestclient, i want to enter the bearer and send a json file(content informations) to the api but i don't know how?
you will find attached a screen of my job.
Thanks in advance.
Hi @shima,
I am not sure that this is directly related to this tutorial. Could I ask you to post a new question and give a bit more information as to what you have done and what you wish to achieve?
Regards
Richard
Actually, we are trying to make a post (json) api call using Oauth2.0 authentication. Please find below step, what we have done with curl command. Exactly, same thing needs to be implemented in Talend.
Step1:-
Passed curl command to fetch access token below:-
curl -v -H "Content-Type: application/x-www-form-urlencoded" -X POST --data "client_id=8BYA26jcZ4cYcivjX0oUABvefmmeqErN&client_secret=lWRoPehoFCmypPls&grant_type=client_credentials&scope=DHub" https://slot1.org009.t-dev.corp.nutty.com/v2/oauth/token --cert /usr/local/certs/nutty.com.crt --key /usr/local/certs/nutty.com.key -v –k
Step2:-
From first step, we will be getting access token:-
{"access_token":"k420G8LGaNQSUXNhih0T3xgAIwyE","token_type":"Bearer","expires_in":"3599"}
Step3:-
Using this access token in curl command we have to make another POST API call:-
curl -v -X POST -H "Content-Type: application/json" -H "Authorization: Bearer k420G8LGaNQSUXNhih0T3xgAIwyE" -H "Correlation-Id: b8905354-a164-b480-9fb2-75c2d1a8498x" -H "Source-System: Dhub" --data @usage2.json https://slot1.org009.t-dev.corp.nutty.com/application/b2b-bds-dev/v1.0/billing-events/700001276364/s... --key /usr/local/certs/nutty.com.key --cert /usr/local/certs/nutty.com.crt -v –k
Please see a snapshot of data, what we are trying to post through usage2.json file:-
{
"instanceId": "b4ee9fc9-7f50-49f4-a90f-32b0ffcf3c73",
"units": 120,
"Source-System": "D-Hub",
"effectiveDate": "2019-07-05T06:00:16.000Z",
"billingSpecId": "GSS_01",
"eventType": "GMM"
}
Final Output, which we expect:-
{"code":201,"status":201,"message":"Created"}
This is what we are trying to achieve in Talend. Is it possible to first authenticate using Oauth2.0 authenticationa nd then pass the access token to make a POST api call.
Hi,
Thanks for wonderful guide for oauth, I'm currently referring this for my project.
I'm having difficulty in tMsgBox on linux(Fedora 29), I don't know if this is default behaviour of tMsgBox but whenever I click outside(want to copy URL) anywhere or do ALT+TAB (for opening browser) the msgbox get's disappear. But the job doesn't get killed it stays running.
Is there any workaround for this or this is only because I'm on linux?
It sounds like the message box has lost focus. Try minimising the Studio or using alt+tab until the message box is viewable.
Hi, I already checked that too, I thought it's minimized but I can't find it in ALT+TAB, also I can't find it in my task bar too.
I will try to switch desktop environment just to see if it's working or not.
Also just for confirmation I tried same on Windows and voila the problem is not there .....
You will need to separate this job into 2 parts; the part which uses a refresh token to update the live auth token (+ the rest of your job) to be run on your server, the part which generates the refresh token will need to be done manually. Once the refresh token is generated, this should continue to run until your refresh token is removed or unauthorised.