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

Access blocked: Default GCP project for googleAnalyticsR’s request is invalid #414

Open
ccampbell1987 opened this issue Nov 22, 2022 · 10 comments
Assignees
Labels

Comments

@ccampbell1987
Copy link

ccampbell1987 commented Nov 22, 2022

When attempting to connect from RStudio Server 1.4.1717, getting an error stating that the request is invalid after running:

library(googleAnalyticsR)
ga_auth()

The error points to the issue:
Error 400: invalid_request
The out-of-band (OOB) flow has been blocked in order to keep users secure. Follow the Out-of-Band (OOB) flow migration guide linked in the developer docs below to migrate your app to an alternative method.
Request details: redirect_uri=urn:ietf:wg:oauth:2.0:oob

There has been a fair amount of activity on the OOB flow issue in the gargle package (see here and here).

The R package googlesheets4 works on my system but uses a static page to generate an authorization code: https://www.tidyverse.org/google-callback

Thanks for your package and any help!

Session Info

R version 4.0.2 (2020-06-22)
Platform: x86_64-koji-linux-gnu (64-bit)
Running under: Amazon Linux 2

Matrix products: default
BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

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

other attached packages:
[1] googleAnalyticsR_1.1.0

loaded via a namespace (and not attached):
[1] rstudioapi_0.13 whisker_0.4 magrittr_2.0.1 rappdirs_0.3.3 usethis_2.0.1 measurementProtocol_0.1.0
[7] tidyselect_1.1.1 R6_2.5.1 rlang_1.0.6 fastmap_1.1.0 fansi_0.5.0 httr_1.4.2
[13] dplyr_1.0.7 tools_4.0.2 utf8_1.2.2 DBI_1.1.1 cli_3.0.1 withr_2.4.2
[19] googleAuthR_2.0.0 ellipsis_0.3.2 assertthat_0.2.1 digest_0.6.27 tibble_3.1.4 gargle_1.2.1.9000
[25] lifecycle_1.0.0 crayon_1.4.1 tidyr_1.2.0 purrr_0.3.4 vctrs_0.3.8 fs_1.5.0
[31] curl_4.3.2 memoise_2.0.0 glue_1.4.2 cachem_1.0.6 compiler_4.0.2 pillar_1.6.2
[37] generics_0.1.0 jsonlite_1.7.2 pkgconfig_2.0.3

@MarkEdmondson1234
Copy link
Collaborator

MarkEdmondson1234 commented Nov 23, 2022

I guess you may be running GitHub version of gargle? Regress to the CRAN version may fix for now?

@ccampbell1987
Copy link
Author

Hi Mark,
I updated because I figured the latest version of gargle may solve the issue, but it did not. I have reran the same authorization with the CRAN version of gargle and obtained the same results - OOB issue. I attached this session info in "Session Info 1" section.

I also installed the latest RStudio Server and R version on my local Ubuntu 22+ machine and tried the same authorization and obtained the same error. I've attached this session info in "Session Info 2."

Here's the Google docs for the OOB issue. The Developer section is a little over my head. AFAIK, you may have to request an extension for OOB authentication for the specific application related to googleAnalyticsR?

Thanks again,
Christopher

Session Info 1

R version 4.0.2 (2020-06-22)
Platform: x86_64-koji-linux-gnu (64-bit)
Running under: Amazon Linux 2

Matrix products: default
BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

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

other attached packages:
[1] googleAnalyticsR_1.1.0

loaded via a namespace (and not attached):
[1] pillar_1.6.2 compiler_4.0.2 googleAuthR_2.0.0 tools_4.0.2 digest_0.6.27 jsonlite_1.7.2
[7] memoise_2.0.0 lifecycle_1.0.0 gargle_1.2.0 tibble_3.1.4 pkgconfig_2.0.3 rlang_0.4.11
[13] cli_3.0.1 DBI_1.1.1 rstudioapi_0.13 curl_4.3.2 fastmap_1.1.0 withr_2.4.2
[19] dplyr_1.0.7 httr_1.4.2 generics_0.1.0 fs_1.5.0 vctrs_0.3.8 askpass_1.1
[25] rappdirs_0.3.3 tidyselect_1.1.1 glue_1.4.2 R6_2.5.1 fansi_0.5.0 measurementProtocol_0.1.0
[31] purrr_0.3.4 tidyr_1.2.0 magrittr_2.0.1 whisker_0.4 ellipsis_0.3.2 usethis_2.0.1
[37] assertthat_0.2.1 utf8_1.2.2 openssl_1.4.5 cachem_1.0.6 crayon_1.4.1

Session Info 2

R version 4.2.2 Patched (2022-11-10 r83330)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Pop!_OS 22.04 LTS #ubuntu 22

Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

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

other attached packages:
[1] googleAnalyticsR_1.1.0

loaded via a namespace (and not attached):
[1] rstudioapi_0.14 whisker_0.4 magrittr_2.0.3 rappdirs_0.3.3 usethis_2.1.6 measurementProtocol_0.1.0
[7] tidyselect_1.2.0 R6_2.5.1 rlang_1.0.6 fastmap_1.1.0 fansi_1.0.3 httr_1.4.4
[13] dplyr_1.0.10 tools_4.2.2 utf8_1.2.2 cli_3.4.1 withr_2.5.0 googleAuthR_2.0.0
[19] assertthat_0.2.1 digest_0.6.30 tibble_3.1.8 gargle_1.2.1 lifecycle_1.0.3 tidyr_1.2.1
[25] purrr_0.3.5 vctrs_0.5.1 fs_1.5.2 curl_4.3.3 memoise_2.0.1 glue_1.6.2
[31] cachem_1.0.6 compiler_4.2.2 pillar_1.8.1 generics_0.1.3 jsonlite_1.8.3 pkgconfig_2.0.3

@ccampbell1987
Copy link
Author

I am apparently blind as well - I didn't see you had a Posix project. This is broken as well for me, hopefully that's more reproducible.

@MarkEdmondson1234
Copy link
Collaborator

Ok thanks, am looking to migrate to my own OOB web URL flow. In the meantime a service key auth will work but not be as convenient.

@MarkEdmondson1234
Copy link
Collaborator

Ok this should now work as per https://github.com/MarkEdmondson1234/googleAnalyticsR/pull/415

I needed to create a OOB redirect page which is now live at https://code.markedmondson.me/googleAnalyticsR/dev/oob and configure a new default web based client.

You can use your own client if you also add that redirect (or your own if you so wish) to the client config page on GCP:

image

...and then download the JSON and set the file path to the environment arg: GAR_CLIENT_WEB_JSON

@MarkEdmondson1234
Copy link
Collaborator

MarkEdmondson1234 commented Nov 25, 2022

Please test it on a RStudio server instance - other auth flows should be unaffected.

MarkEdmondson1234 added a commit that referenced this issue Nov 25, 2022
@ccampbell1987
Copy link
Author

Worked for me! Thank you!

The only issue I noticed is that users need the development version of gargle due to gargle_oauth_client_from_json. Maybe just a note about devtools::install_github("r-lib/gargle", force = TRUE) could suffice until gargle updates on CRAN.

@MarkEdmondson1234
Copy link
Collaborator

Ok cool, when new gargle is released on CRAN I'll push this update as well afterwards

@kosetsky
Copy link

Ok cool, when new gargle is released on CRAN I'll push this update as well afterwards

The new version of gargle (1.3.0) was released on Jan 30, 2023.

@MarkEdmondson1234
Copy link
Collaborator

Ok will get on it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants