Description
I tried to follow instructions on post #184 by calling first gs4_auth(cache=".secrets") before deploying the app to shinyapps.io. In the system log, I can confirm the existence of cached token key file in ./secret folder. However, I still get "Can't get Google credentials." error on shinyapps.io. Thanks.
2023-12-20T15:31:42.518170+00:00 shinyapps[10831335]: gs4_auth(cache = ".secrets", email = TRUE, use_oob = TRUE)
2023-12-20T15:31:43.464681+00:00 shinyapps[10831335]: Error in gs4_auth(cache = ".secrets", email = TRUE, use_oob = TRUE) :
2023-12-20T15:31:43.468629+00:00 shinyapps[10831335]: Can't get Google credentials.
2023-12-20T15:31:43.472800+00:00 shinyapps[10831335]: ℹ Are you running googlesheets4 in a non-interactive session? Consider:
2023-12-20T15:31:43.477237+00:00 shinyapps[10831335]: • Call gs4_deauth()
to prevent the attempt to get credentials.
2023-12-20T15:31:43.482349+00:00 shinyapps[10831335]: • Call gs4_auth()
directly with all necessary specifics.
2023-12-20T15:31:43.486107+00:00 shinyapps[10831335]: ℹ See gargle's "Non-interactive auth" vignette for more details:
2023-12-20T15:31:43.489921+00:00 shinyapps[10831335]: ℹ https://gargle.r-lib.org/articles/non-interactive-auth.html
2023-12-20T15:31:43.493800+00:00 shinyapps[10831335]: Calls: local ... tryCatch -> tryCatchList -> tryCatchOne ->
2023-12-20T15:31:43.497625+00:00 shinyapps[10831335]: Execution halted
2023-12-20T15:31:43.501376+00:00 shinyapps[10831335]: Shiny application exiting ...
2023-12-20T15:47:25.464647+00:00 shinyapps[10831335]: Container event from container-8999208: stop
Have you tried my fix?
gs4_auth(cache = ".secrets")
Use this for the first time running the app in R to get the OAuth token. When deploying the app to the server, upload this .secrets folder too. Now replace the code above with the code below and upload the app to the server. Use_oob=TRUE is basically what did the trick for me.
gs4_auth(cache = ".secrets", email = TRUE, use_oob = TRUE)
Originally posted by @comicalequation in #184 (comment)