P
P
pfedorov0310902021-07-28 11:37:00
Java
pfedorov031090, 2021-07-28 11:37:00

How to create a Google service account?

I'm trying to run the script according to the instructions here: https://developers.google.com/sheets/api/quickstar...
I run the code and it throws errors here:

GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(
                HTTP_TRANSPORT, JSON_FACTORY, clientSecrets, SCOPES)
                .setDataStoreFactory(new FileDataStoreFactory(new java.io.File(TOKENS_DIRECTORY_PATH)))
                .setAccessType("offline")
                .build();

As I understand it, the problem occurs at the time of connecting through a service account to a google document.
I don't understand how to fix it. I've been tinkering for a week now. Tell me, can anyone do something similar in Java? In python, I did it.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question