Google sheets authentication doesn't work when publishing to Connect

I want to publish Rmd as a document with source code that will run every day. I followed gargle documentation on Project-level OAuth cache. My authentication code looks like:

googlesheets4::gs4_auth(cache = ".secrets", email = TRUE)

It works as expected when running on Workbench but I can't publish it because of Can't get Google credentials. error. When I publish the document, there's no possibility to include the .secrets folder although I read here that I should include it.

How do you publish to Rstudio Connect? Which version of Workbench and rsconnect do you use? For me files in a .secret folder are added automatically even when the folder itself is hidden:
image

Thank you for your reply.

I use rsconnect_0.8.25 and RStudio Connect v2022.03.2 (together with R 4.1). I have 1 Rmd file that I want to publish as "document with source code", like that:
Screenshot 2022-05-13 at 07.43.14

I want to publish it from RStudio Workbench.

Interesting, publishing an R Markdown document is different than publishing a Shiny app, which is what I tried. In addition, the file finder from "Add More ..." does not respect the "Show Hidden Files" setting of the main files pane. I will report this to our developers. As a workaround, you can explicitly navigate to the .secrets folder via "..." in the file finder:
Peek 2022-05-13 09-48

1 Like

Thank you, it works now!