I have a Shiny app that uses googlesheets non-interactive auth function to access and edit a Google Sheet. This app worked as of spring/summer 2024 and upon firing it up again, it fails.
I referenced the Non-interactive auth documentation and vignette to build the code in the first place, and have revisited it to troubleshoot.
This is the closest I can provide to a reproducible example:
library(googledrive)
library(googlesheets4)options(
gargle_oauth_cache = ".secrets",
gargle_oauth_email = TRUE,
gargle_verbosity = "debug"
)file_name <- "https://docs.google.com/spreadsheets/mysheet"
Inventory_Raw <- read_sheet(file_name, sheet = "Inventory")
my .secrets folder contains only one token, recently refreshed.
when running the gargle_verbosity = "debug" option, I get the following:
attempt to access internal gargle data from: googlesheets4
trying token_fetch()
Trying credentials_byo_oauth()
...
Error caught by token_fetch()
:
inherits(token, "Token2.0") is not TRUE
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()
...
We don't seem to be on GCE.
trying credentials_user_oauth2()
attempt to access internal gargle data from: googlesheets4
Gargle2.0 initialize
adding "userinfo.email" scope
loading token from the cache
email: '*'
oauth client name: tidyverse-clio
oauth client name: installed
oauth client id: 60339978585132-dpegarb5tt0et3go5of2374d83ifevk5086.apps.googleusercontent.com
scopes: ...spreadsheets, ...userinfo.email
token(s) found in cache:
c1356dc354db960120c8cdar9b2bd868d1bf25_email@gmail.com
token we are looking for:
no matching token in the cache
initiating new token
It seems as though the token is being discovered, but not matched to what is being expected, which leads to initiating a new token retrieval.