MarkEdmondson1234 / googleAuthR

Google API Client Library for R. Easy authentication and help to build Google API R libraries with OAuth2. Shiny compatible.
https://code.markedmondson.me/googleAuthR
Other
175 stars 51 forks source link

Can no longer authenticate on a Cloud Compute instance using gar_gce_auth()? #161

Closed mkiang closed 5 years ago

mkiang commented 5 years ago

What goes wrong

Before v1, gar_gce_auth() would authenticate on a Google Cloud Compute instance automatically and allow me to access any bucket that the GCE instance already had access to. It does not appear to do so anymore and silently fails.

I cannot use an interactive authentication and my institution does not allow me to get the authentication json file so this seemed to be the only way I could authenticate? For now, I've downgraded to previous versions.

Steps to reproduce the problem

Please note that if a reproduceable example that I can run is not available, then the likelihood of getting any bug fixed is low.

> googleAuthR::gar_gce_auth()
> googleCloudStorageR::gcs_list_objects("som-db")
2019-10-07 23:06:23> No authorization yet in this session!
2019-10-07 23:06:23> No  .httr-oauth  file exists in current working directory.  Do library authentication steps to provide credentials.
Error: Invalid token

Expected output

Before v1, a token would be generated from the Google Cloud Compute instance. No output but gcs_list_objects() would work, for example.

Actual output

No warning after the gar_gce_auth() command.

> googleAuthR::gar_gce_auth()
> googleCloudStorageR::gcs_list_objects("som-db")
2019-10-07 23:06:23> No authorization yet in this session!
2019-10-07 23:06:23> No  .httr-oauth  file exists in current working directory.  Do library authentication steps to provide credentials.
Error: Invalid token
SchnockNicolas commented 5 years ago

FYI, I have similar problems on a shiny application. It is on a docker, I build it regularly. By rebuilding it yesterday I got this after log in from google. It worked with the previous built.

(I use GoogleAuthR & googleAnalyticsR, I don't know yet which one is the problem)

2019-10-09 21:43:45> Request Status Code: 401 Warning: Error in : API returned: Invalid Credentials 99: stop 98: checkGoogleAPIError 97: _f 95: cachedHttrRequest 94: memDoHttrRequest 93: f 92: gar_api_page 91: f 90: with_shiny 89: <reactive:ga_accounts> [/srv/shiny-server/GoogleAnalytics/app.R#146] 73: ga_accounts 72: observeEventHandler [/srv/shiny-server/GoogleAnalytics/app.R#181] 1: runApp

I'll try to give more details (versions and minimal replication of problem)

MarkEdmondson1234 commented 5 years ago

It should still work, I'm using it. May I check what versions you are using? sessionInfo() and run the auth process with options(googleAuthR.verbose=2). Before version 1.1.1 you needed to specify the scopes yourself but after that it defaults to " https://www.googleapis.com/auth/cloud-platform" - perhaps if you are not doing that it is making the issue.

On Thu, 10 Oct 2019 at 09:07, Nschnock notifications@github.com wrote:

I have similar problems on a shiny application. It is on a docker, I build it regularly. By rebuilding it yesterday I got this after log in from google.

(I use GoogleAuthR & googleAnalyticsR)

2019-10-09 21:43:45> Request Status Code: 401 Warning: Error in : API returned: Invalid Credentials 99: stop 98: checkGoogleAPIError 97: _f 95: cachedHttrRequest 94: memDoHttrRequest 93: f 92: gar_api_page 91: f 90: with_shiny 89: [/srv/shiny-server/GoogleAnalytics/app.R#146] 73: ga_accounts 72: observeEventHandler [/srv/shiny-server/GoogleAnalytics/app.R#181] 1: runApp

I'll try to give more details (versions and minimal replication of problem)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/MarkEdmondson1234/googleAuthR/issues/161?email_source=notifications&email_token=AAYCPLGYZAHU5ERGFU4FJODQN3IE5A5CNFSM4I6LDO7KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEA3DHMA#issuecomment-540423088, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYCPLDI3R2KUWQCW7APM33QN3IE5ANCNFSM4I6LDO7A .

-- Mark Edmondson

mkiang commented 5 years ago

Sorry, I closed that project and didn't get the sessionInfo(). I'll close this issue and re-open if I run into it again.