Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad Request (HTTP 400) with Service Account #287

Closed
cfisher5 opened this issue Oct 8, 2024 · 2 comments
Closed

Bad Request (HTTP 400) with Service Account #287

cfisher5 opened this issue Oct 8, 2024 · 2 comments

Comments

@cfisher5
Copy link

cfisher5 commented Oct 8, 2024

Over the last several days my scripts that pull data from googlesheets have broken and I have traced the issue to this:

token = gargle::credentials_service_account(path='Googlesheet Auth.json')
Error in init_oauth_service_account(self$secrets, scope = self$params$scope,  :
  Bad Request (HTTP 400).

Googlesheet Auth.json is the path to the service account I've been using for a long time, and this issue is only happening on a windows 2016 server. This exact line of code is working for me on my macbook locally.

sessionInfo() gives me the following:

R version 4.4.1 (2024-06-14 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows Server 2016 x64 (build 14393)

Matrix products: default


locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

time zone: America/Chicago
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] gargle_1.5.2        googledrive_2.1.1   jsonlite_1.8.9
[4] googlesheets4_1.1.1

loaded via a namespace (and not attached):
 [1] crayon_1.5.3     vctrs_0.6.5      httr_1.4.7       cli_3.6.3
 [5] rlang_1.1.4      purrr_1.0.2      promises_1.3.0   generics_0.1.3
 [9] glue_1.7.0       openssl_2.2.2    askpass_1.2.0    httpuv_1.6.15
[13] fansi_1.0.6      rappdirs_0.3.3   cellranger_1.1.0 tibble_3.2.1
[17] lifecycle_1.0.4  compiler_4.4.1   dplyr_1.1.4      fs_1.6.4
[21] Rcpp_1.0.13      pkgconfig_2.0.3  later_1.3.2      R6_2.5.1
[25] tidyselect_1.2.1 utf8_1.2.4       pillar_1.9.0     curl_5.2.3
[29] magrittr_2.0.3   tools_4.4.1

I am hoping someone has a few things to try! I appreciate it in advance. I love these packages and hope i can figure this out, but this issue has really stumped me.

@jennybc
Copy link
Member

jennybc commented Oct 8, 2024

This sounds a bit like #111 which ended up being a time zone / clock skew issue. That thread also raises the possibility of using httr::with_verbose() to see exactly what's going over the wire.

For more general purpose troubleshooting techniques, see this article:

https://gargle.r-lib.org/articles/troubleshooting.html

@cfisher5
Copy link
Author

cfisher5 commented Oct 8, 2024

clock was somehow 11 minutes into the future. Thanks @jennybc that was a life saver. Who knows how much longer I could have spent on this!

@cfisher5 cfisher5 closed this as completed Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants