googlesheets4 icon indicating copy to clipboard operation
googlesheets4 copied to clipboard

Use auth token with httr read rds file

Open HugoGit39 opened this issue 6 months ago • 0 comments

Hi

So let me begin that its not a real bug, but more a question for help:

From the rangespread() function I see that a google sheet can be read using the auth token via:

`# service account token drive_auth(path = "....json")

#google4sheets authentication gs4_auth(token = drive_token())

token <- gs4_token() response <- httr::GET(url, config = token) df <- read_csv(content(response, type = "raw"))`

So for an RDS file I thought it should be the same. However the response I get is a

Content-Type: text/html; charset=utf-8

Does anyone know how i can extract the df correctly?

Cause without an auth token the response of a RDS file can be read via:

response <- httr::GET(url)
cn <- rawConnection(httr::content(response, type = "raw"))
df <- readRDS(gzcon(cn))

HugoGit39 avatar Dec 12 '23 10:12 HugoGit39