-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: parse error: premature EOF from gs4_auth_configure() #260
Comments
Your JSON file is not going to be found inside the googlesheets4 installation, which is what you're claiming above. Why are you using |
Same error:
|
Why are you using |
Honestly the documentation for connecting via a server is a bit lacking and I'm struggling to make this work |
When I type
So I just tried that. When I supply the direct path:
How can I trouble shoot this? |
Okay, so I created a service account on GCP then enabled API access to Google Sheets. Then, I create both an API Key as well as a OAuth 2.0Client ID
Also getting an error here? Under the GCP Permissions I can see that my personal e-mail is set as a PRINCIPALS to this service account so I'm not sure what's wrong... |
You seem to be configuring 3 different auth methods (oauth user flow, API key, service account token), when I suspect you only need to want 1. It feels pretty confused. When you get permission denied, who are you auth'ed as? Yourself or the service account?
|
Okay let's just try one method then from a fresh console. I will also create new credentials on GCP for OAuth client ID (Application Type: Desktop APP, name: test2) which allows me to download a JSON file If I do the following, it shows me that there is no current user?
However, using
|
googlesheets4 does not load a token until one is needed. So you need to do something that requires auth or trigger auth explicitly with An OAuth app is one part of the machinery needed for a user to complete the process known as "three-legged oauth". Configuring the app does not actually obtain a token on behalf of any particular authenticated user. |
You can not do this on Servers though....
Can you please provide code to be more clear in what I need to do? The link you shared has those exact steps I just described for creating my OAUth Client ID above:
This was followed by me using
So what step am I missing? How to I tell |
Google has shut down out-of-band auth for newly obtained OAuth apps which, presumably, includes yours. No real replacement is offered for our use case, sadly. The tidyverse oauth app which ships with googlesheets4 is grandfathered in, for a limited period of time, and can still be used for OOB auth. So if you want to auth with a user token, via R/RStudio on a server, you have two options:
The process of deploying a locally obtained token to a server is described here: |
Hi @jennybc, thanks for sharing link to option 2 there. After creating the token locally and SCP it to the server it seems to work for the
However, I'm still getting an error from
Any idea what else am I missing here?
|
Hard to say since I'm clearly not seeing all of the code. Or maybe I am? In which case I can say for sure that you need to explicitly tell googlesheets4 to use the same token as googledrive is using: https://googlesheets4.tidyverse.org/articles/drive-and-sheets.html It won't automatically do so. |
Hi @jennybc the critical part I was missing was telling googlesheet4 to use the same token as googledrive:
Thank you very much! |
Giant thanks to Matthew Oldach (moldach) for asking these questions 1.75 years ago. I've been trying to deploy a Plumber API on AWS the past week, and the part I was missing was telling gs4 to use the same token as googledrive. In particular, this is how this solution worked for me (and I've tried taking out pieces of this one, so some how some way, all the pieces in this are needed):
|
The two
|
From Google Cloud Platform I create credentials for OAuth 2.0 Client and it says:
Your Client ID: XXXXX
Your Client Secret: XXXXX
Download JSON
I've downloaded the JSON file and attempt to set up authorization but I get a premature EOF error
The text was updated successfully, but these errors were encountered: