For the past 6+ months I read and wrote from R to Google Sheets without any issues, with the googlesheets4 package. Yesterday, all of a sudden, I started to get the 'Can't get Google credentials' error and I can't seem to find a solution to it.
I've always used gs4_auth('email address'), no other details.
I read the troubleshooting advice for gargle, I also found another thread here with suggestions, but nothing worked for me unfortunately. Here is what I get when changing gargle verbosity to 'debug':
trying token_fetch()
trying credentials_service_account()
Error caught by token_fetch()
:
Argument 'txt' must be a JSON string, URL or file.
trying credentials_external_account()
aws.ec2metadata not installed; can't detect whether running on EC2 instance
trying credentials_app_default()
trying credentials_gce()
trying credentials_byo_oauth()
Error caught by token_fetch()
:
inherits(token, "Token2.0") is not TRUE
trying credentials_user_oauth2()
Gargle2.0 initialize
attempt to access internal gargle data from: googlesheets4
adding "userinfo.email" scope
Error caught by token_fetch()
:
ReadItem: unknown type 50, perhaps written by later version of R
I don't have a clue what to change based on this info.
I also read that this sudden error may happen if the cache where gargle saves authentication data is full. But I don't find the cache. I tried to run this:
require(gargle) gargle_oauth_sitrep()
And I get: Error in FUN(X[[i]], ...) : ReadItem: unknown type 50, perhaps written by later version of R.
My version of R is 4.1.2 now, but before, it was 4.1.0. I updated it hoping it would solve something, but it didn't. I also reinstalled a few packages: curl, openssl, gargle. Still not working.
I am out of ideas now. Can anyone help?