From Thursday, July, 9, 3:00 PM Pacific,
our Community site will be in
read-only mode
through Sunday, July 12th.
Thank you for your patience.

How to authenticate with gDrive permanently?

Highlighted
Six Stars

How to authenticate with gDrive permanently?

I followed this procedure : https://help.talend.com/reader/Ovc10QFckCdvYbzxTECexA/EoAKa_oFqZFXH0aE0wNbHQ

 

But this token is only valid for 1 hour. How can I arrange this in a Talend-job to get the latest authentication token, that I can reuse then?


Accepted Solutions
Highlighted
Community Manager

Re: How to authenticate with gDrive permanently?

Hi Stefan,

 

It's been sorted. It is here. It is quite complicated in parts and was written in 2014 (so Google may ave tweaked a few things), but it should help you resolve this. The job and config file are attached to the main post.

View solution in original post


All Replies
Highlighted
Community Manager

Re: How to authenticate with gDrive permanently?

You need to use a refresh token. You will need to look at Google docs for how to do this. The basic steps in Talend will be this....

 

1) Carry out initial OAuth handshake to get the Refresh token. You may need to do this manually within the Studio. They way I have done it is to return the URL it needs you to open and authenticate in a tMsgBox and then retrieve the callback URL after you have done that. Look at the Google docs to see how to retrieve the Refresh token from that.

2) In your job base your call on a tLoop. While unsuccessful, try again. If it is unsuccessful, it means your token (not Refresh token) is out of date. At this point you need to use your Refresh token to generate a new token. 

3) Use your newly generated token to access your GDrive

 

Highlighted
Six Stars

Re: How to authenticate with gDrive permanently?

Hi,

 

I'm rather new to Talend, so it's not all clear to me what you describe. In one of your previous posts you described the procedure in more detail (https://www.rilhia.com/tutorials/using-oauth-20-talend-access-google-apis).

 

Unfortunateley I cannot open this url. Is it possible to send me a sample job, where I can see the different components and their values.

Highlighted
Community Manager

Re: How to authenticate with gDrive permanently?

Yes, that was a relatively complicated tutorial I put together and would have been useful in this situation. Unfortunately thanks to some friends of ours in Russia, my site was attacked and destroyed. I haven't had the time over the last few months to bring it back up again.

 

I will see if I can get onto the box tonight and retrieve the tutorial data. If I can, I will post a "How To" on here and point you to it. 

Highlighted
Six Stars

Re: How to authenticate with gDrive permanently?

That would be great indeed.
Highlighted
Community Manager

Re: How to authenticate with gDrive permanently?

I managed to get access to my server and transferred the tutorial here......unfortunately it seemed to trigger some sort of SPAM filter and got removed. I have contacted the forum admins to see if they can sort it for me

Highlighted
Six Stars

Re: How to authenticate with gDrive permanently?

Hi thnks,
 
in the mean time you may already send it to my personal email address Stefaan.Somers@gmail.com if you want.
Highlighted
Community Manager

Re: How to authenticate with gDrive permanently?

Hi Stefan,

 

It's been sorted. It is here. It is quite complicated in parts and was written in 2014 (so Google may ave tweaked a few things), but it should help you resolve this. The job and config file are attached to the main post.

View solution in original post

Highlighted
Six Stars

Re: How to authenticate with gDrive permanently?

I see that it works with the refresh token. But this token also apears only
to be valid for 24hours. Can I conclude it's impossible then to run a
scheduled jog daily then without any user-interaction?
Highlighted
Community Manager

Re: How to authenticate with gDrive permanently?

This is strange, Google's documentation says this about refresh tokens...

 

"Token expiration

You must write your code to anticipate the possibility that a granted refresh token might no longer work. A refresh token might stop working for one of these reasons:

  • The user has revoked your app's access.
  • The refresh token has not been used for six months.
  • The user changed passwords and the refresh token contains Gmail scopes.
  • The user account has exceeded a maximum number of granted (live) refresh tokens."

I wouldn't expect it to expire after 24 hours. But if yours does, then you will need to re-carry out the initial process. My belief is, and experience has shown me, that as long as you regularly make use of the refresh token it seems to last forever. So maybe ensuring your process is run once a day will do it.

Highlighted
Community Manager

Re: How to authenticate with gDrive permanently?

Did this resolve your issue?

Highlighted
Six Stars

Re: How to authenticate with gDrive permanently?

It seems to be working now indeed

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog