tidyverse/googlesheets4

Cant provide user login & consent on app published to open source Shiny Server

ferguskeatinge opened this issue · 4 comments

Apologies if iv made a silly error here, OAuth flow is not my strong point...

Iv published my application to an AWS EC2 Instance running Ubuntu using the free version of Shiny Server. The application is exactly the same as the one iv published to Shinyapps.io where authorization wasn't an issue at all.

When i go to the application i get an error saying that its failing to initialize when trying to authorize access to my google account.

The code starts with gs4_auth_configure with the path directed to my .json, then gs4_auth, with my email specified and the cache is my .secrets.

This approach worked perfectly on shinyapps.io first time i access the app it took me to authorization page and worked perfectly after that (stilly does). But not the same process on shiny server.

The app works perfectly when i remove the auth code and any functions from the package.

Any input welcome.

Hi Fergus,

Did you update the urls allowed on the google console? The auth request will no longer be calling from shinyapps.io so you'll need whatever url your EC2 is using whitelisted.

Where in the API console do i update this URL?

The code starts with gs4_auth_configure with the path directed to my .json, then gs4_auth, with my email specified and the cache is my .secrets.... This approach worked perfectly on shinyapps.io first time i access the app it took me to authorization page and worked perfectly after that (stilly does).

I'm surprised this ever worked!

In general, gargle is not (yet) prepared to handle Google auth in a Shiny context. That is, there's no feature that truly lets a user of the app go through a web flow they might expect and enjoy. This is going to change soon-ish, i.e. in a matter of months. The code exists as a pull request on the gargle repo, but we need to decide where it should live and finish it off, accordingly.

Luckily, it sounds like you aren't trying to let arbitrary users log into Google via your app. It sounds like it's just you / one user? Can you confirm that? There are several approaches for that problem that work well today.

Closing to due lack of follow up.