Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
somersst
Contributor III
Contributor III

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?

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable

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

11 Replies
Anonymous
Not applicable

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

 

somersst
Contributor III
Contributor III
Author

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.

Anonymous
Not applicable

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. 

somersst
Contributor III
Contributor III
Author

That would be great indeed.
Anonymous
Not applicable

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

somersst
Contributor III
Contributor III
Author

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

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.

somersst
Contributor III
Contributor III
Author

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?
Anonymous
Not applicable

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.