#1 2023-06-08 13:58:51

kshimeld
Member
Registered: 2023-05-17

Google Drive Datasink Setup

We're trying to set up a Google Drive datasink in our trial version of Enterprise and having issues getting it working. I've enabled the Drive SDK in the Google developer console and set up the app key and secret key. Whenever we click 'Datasink OAuth2 Authentication Setup', we're able to select the account, click allow, but then it throws an exception:

Type 
Exception Report

Message 
Error while generating refresh token

Description 
The server encountered an unexpected condition that prevented it from fulfilling the request.

Exception

javax.servlet.ServletException: Error while generating refresh token
	net.datenwerke.rs.oauth.server.oauth.OAuthServlet.doGet(OAuthServlet.java:88)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:655)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
	com.google.inject.servlet.ServletDefinition.doServiceImpl(ServletDefinition.java:290)
	com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:280)
	com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:184)
	com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:89)
	com.google.inject.persist.PersistFilter.doFilter(PersistFilter.java:94)
	com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:121)
	com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:133)
Root Cause

com.github.scribejava.core.model.OAuth2AccessTokenErrorResponse: {
  "error": "invalid_grant",
  "error_description": "Bad Request"
}
	com.github.scribejava.core.extractors.OAuth2AccessTokenJsonExtractor.generateError(OAuth2AccessTokenJsonExtractor.java:77)
	com.github.scribejava.core.extractors.OAuth2AccessTokenJsonExtractor.extract(OAuth2AccessTokenJsonExtractor.java:37)
	com.github.scribejava.core.extractors.OAuth2AccessTokenJsonExtractor.extract(OAuth2AccessTokenJsonExtractor.java:17)
	com.github.scribejava.core.oauth.OAuth20Service.sendAccessTokenRequestSync(OAuth20Service.java:157)
	com.github.scribejava.core.oauth.OAuth20Service.getAccessToken(OAuth20Service.java:237)
	com.github.scribejava.core.oauth.OAuth20Service.getAccessToken(OAuth20Service.java:232)
	net.datenwerke.rs.oauth.service.oauth.OAuthAuthenticationServiceImpl.generateRefreshToken(OAuthAuthenticationServiceImpl.java:62)
	net.datenwerke.rsenterprise.license.service.EnterpriseCheckInterceptor.invoke(EnterpriseCheckInterceptor.java:40)
	com.google.inject.persist.jpa.JpaLocalTxnInterceptor.invoke(JpaLocalTxnInterceptor.java:64)
	net.datenwerke.rs.oauth.server.oauth.OAuthServlet.doGet(OAuthServlet.java:84)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:655)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
	com.google.inject.servlet.ServletDefinition.doServiceImpl(ServletDefinition.java:290)
	com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:280)
	com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:184)
	com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:89)
	com.google.inject.persist.PersistFilter.doFilter(PersistFilter.java:94)
	com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:121)
	com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:133)

rsversion.properties:

#Fri May 26 13:10:51 CEST 2023
version=RS4.6.1-6092
schemaversion=RS3.0-26
buildDate=1685099450694-2023-05-26-13-10-32

Offline

#2 2023-06-12 07:55:01

eduardo
Administrator
Registered: 2016-11-01
Website

Re: Google Drive Datasink Setup

Hi kshimeld,

the error is:
com.github.scribejava.core.model.OAuth2AccessTokenErrorResponse: {
  "error": "invalid_grant",
  "error_description": "Bad Request"
}

googling this error I find:
https://stackoverflow.com/questions/105 … rom-google
"related to invalid/expired/revoked tokens" -> pls make sure you are giving the token enough permissions and the token is valid.
Also pls check the other answers found here.

Also, I found some information here:
https://stackoverflow.com/questions/727 … uest-error

Regards,
Eduardo

Offline

#3 2023-06-16 12:56:03

kshimeld
Member
Registered: 2023-05-17

Re: Google Drive Datasink Setup

I'm pretty sure that I gave the app key and secret key the correct permissions. I get the Google login screen below:

XlTUwBX.png

It seems like even though the setup fails with that error, when I go to test the datasink, it'll create the folder and upload the test file correctly.

Is there a way to use an existing folder for the google drive datasink? I tried using the name of an existing folder, but it just created a second folder with the same name and entering a folder ID just makes a folder with the ID as the name.

Offline

Board footer

Powered by FluxBB