I have two servers.
The first one is running a headless Kotlin/JVM program, and is not accessible for the "client", so it's not possible to authenticate on this server directly. It uploads given video on YouTube.
The second one is web interface on Python, which is accessible for the client. The client is authenticating with OAuth 2 on this server, and the server gets the following data:
{"token": "...", "refresh_token": "...", "token_uri": "https://www.googleapis.com/oauth2/v3/token", "client_id": "....apps.googleusercontent.com", "client_secret": "...", "scopes": ["https://www.googleapis.com/auth/youtube.force-ssl"]}
I want to pass it to the second server, but I don't know how to pass these parameters to the Google's Oauth library. If I do it like this:
val credential = Credential.Builder(BearerToken.authorizationHeaderAccessMethod())
.setTokenServerUrl(GenericUrl("https://www.googleapis.com/oauth2/v3/token"))
.setTransport(httpTransport)
.setJsonFactory(jsonFactory)
.clientAuthentication() // Where to get the parameter?
.build()
credential.accessToken = "..."
credential.refreshToken = "..."
It throws an exception if I don't set the clientAuthentication
, but I don't know how to construct it:
Exception in thread "main" java.lang.IllegalArgumentException: Please use the Builder and call setJsonFactory, setTransport, setClientAuthentication and setTokenServerUrl/setTokenServerEncodedUrl
Is there any simple way to pass token parameters?