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

RStudio Cloud tutorial Authentication isn't working Error 400: invalid_request #434

Open
cansavvy opened this issue Nov 9, 2023 · 4 comments
Assignees
Labels

Comments

@cansavvy
Copy link

cansavvy commented Nov 9, 2023

What goes wrong

First of all, thanks so much for your work on these awesome packages! Really useful for me!

I've still been trying to figure out the problems from #426 because I need to obtain google analytics data for an R package I'm working on. So I've been trying to construct this package's auth steps myself with no avail.

To test if this was a me problem I followed the tutorial in RStudio (now Posit) Cloud that is linked here https://code.markedmondson.me/googleAnalyticsR/articles/setup.html#quickstart-rstudio-cloud-project

Steps to reproduce the problem

I followed the steps in the tutorial and ran:

library(googleAnalyticsR)
ga_auth()

In the Auth consent page I received these error messages:

Screenshot 2023-11-09 at 10 11 09 AM

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

You can’t sign in because Default GCP project for googleAnalyticsR sent an invalid request. You can try again later, or contact the [developer](https://accounts.google.com/) about this issue. [Learn more about this error](https://support.google.com/accounts/answer/12379384)
If you are a developer of Default GCP project for googleAnalyticsR, see [error details](https://accounts.google.com/).
Error 400: invalid_request

Screenshot 2023-11-09 at 10 11 15 AM

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

Expected output

I expected I would be able to authenticate the package as described in the tutorial.

Actual output

Before you run your code, please run:
options(googleAuthR.verbose=2) and copy-paste the console output here.
Check it doesn't include any sensitive info like auth tokens or accountIds - you can usually just edit those out manually and replace with say XXX

As suggested in the bug report, I ran options(googleAuthR.verbose=2) but nothing happened.

I also tried in this cloud session to use the development version by running:

install.packages("remote") 
remotes::install_github("MarkEdmondson1234/googleAuthR")

I then restarted the R session and tried again.

But I still got the same results as above.

sessionInfo()

R version 4.0.5 (2021-03-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.6 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/atlas/libblas.so.3.10.3
LAPACK: /usr/lib/x86_64-linux-gnu/atlas/liblapack.so.3.10.3

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

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

other attached packages:
[1] googleAnalyticsR_1.0.0

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.4.6              rstudioapi_0.13           whisker_0.4               magrittr_1.5             
 [5] rappdirs_0.3.3            usethis_2.0.1             measurementProtocol_0.1.0 tidyselect_1.1.0         
 [9] R6_2.5.1                  rlang_1.1.2               fastmap_1.1.1             httr_1.4.7               
[13] dplyr_1.0.0               tools_4.0.5               cli_3.6.1                 googleAuthR_2.0.1        
[17] ellipsis_0.3.1            assertthat_0.2.1          digest_0.6.33             tibble_3.0.1             
[21] gargle_1.5.2              lifecycle_1.0.4           crayon_1.3.4              tidyr_1.1.0              
[25] purrr_0.3.4               vctrs_0.3.1               fs_1.6.3                  curl_5.1.0               
[29] memoise_2.0.1             glue_1.6.2                cachem_1.0.8              compiler_4.0.5           
[33] pillar_1.4.4              generics_0.0.2            jsonlite_1.8.7            pkgconfig_2.0.3       
@cansavvy
Copy link
Author

cansavvy commented Nov 9, 2023

I clicked on the link in the report error message and it brings me to: https://developers.google.com/identity/protocols/oauth2/resources/oob-migration

I think this is maybe the issue but I am very new to all these Google API and OAuth things so I am not sure.

What is OOB?
OAuth [out-of-band (OOB)](https://developers.google.com/identity/protocols/oauth2/native-app#manual-copypaste), also referred to as the manual copy/paste option, is a legacy flow developed to support native clients which do not have a redirect URI to accept the credentials after a user approves an OAuth consent request. The OOB flow poses a remote phishing risk and clients must migrate to an alternative method to protect against this vulnerability.
The OOB flow is being deprecated for all client types i.e. Web applications, Android, iOS, Universal Windows Platform (UWP), Chrome apps, TVs & limited-input devices, Desktop apps.

@gronerik
Copy link
Collaborator

gronerik commented Sep 5, 2024

Hi @cansavvy! Sorry for the delay on getting a response to you. Since some time has already passed, I'm just checking quickly first, is this still unresolved? Happy to help you out if you still need support on this.

@cansavvy
Copy link
Author

cansavvy commented Sep 5, 2024

No worries. I ended up just making my own package to handle Google Analytics and authentication for me (along with other things) I was hoping to use this package to handle it for me but couldn't get that to work. https://www.metricminer.org/

@gronerik
Copy link
Collaborator

gronerik commented Sep 5, 2024

Nice! And great work! :)

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