Googledrive connection

Highlighted
One Star

Googledrive connection

Hi community,
I'm trying to use google drive components and I dont't find a way to use OAuth 2.0 "refresh token".
My aim is to avoid access tokens expiration.
Is it planned to have this possibility in next versions?
Thakns for your reply,
Youssef
Employee

Re: Googledrive connection

This is not handled by any Talend components (as far as I am aware) and the expectation is that you generate the access token yourself and simply populate the component. I have written a job that deals with getting the first access token with human intervention and then subsequent tokens are generated via the refresh token automatically. I have written a tutorial with a copy of the example job included here. I'd be interested in what you think
Regards
Richard
One Star

Re: Googledrive connection

Thanks a lot for your reply and for your interesting tutoriel.
As you did, I used the tRestClient to get an access token based on a refresh token, and it works perfectly!
However, I have one little remark about your subjob, whose purpose  is to return a valid access token:
The successful run of the "Test List Files Services" conponent  doesn't mean that the access_code will remain valid when the main job will use it.
Thanks again for your help,
Youssef
Employee

Re: Googledrive connection

Thanks for your response. The purpose of this job is to be run immediately before the access token is needed. Therefore it will be valid when the you need it. Or at least that is the idea. If you have jobs running for hours this job may need to be configured to run again every time a connection fails, but that would not be hard to implement :-)
Seventeen Stars

Re: Googledrive connection

One way is also using a service account. Google definitely recommend such accounts for automated processes. 
The custom component tGoogleDrive from Talend Exchange provides all capabilities to use such accounts. It is also possible to work with permanent refresh tokens (Application Client ID).
One advantage is, you can use the document-Id as method to address your document because in Google Drive you can have multiple documents with the same name.