How to force authentication using shiny and bigrquery

57 views Asked by At

I'm building a shiny app to connect to big query and return info on projects, datasets and tables in a big query account. I'm also using the bigrquery package and would like to know how to force it to ask for authentication.

Right now, once I run load the bigrquery package and run bq_projects(). I am able to see all my projects. I believe this is because while working on a previous dbt project, I enabled Local Oauth gcloud setup via gcloud CLI

1

There are 1 answers

0
Mel On

You can use the googleAuthR library for this use case.

If you want to make a multi-user Shiny app, where users login to their own Google account and the app works with their data, googleAuthR provides the below functions to help make the Google login process as easy as possible.

There are now these types of logins available, which suit different needs:

  • gar_shiny_* functions. These create a login UI before the main Shiny UI loads. Authentication occurs, and then the main UI loads but with the created unique user’s authentication. You can then use httr based Google authentication functions normally as you would offline.

  • googleSignIn module - this is for when you just want to have a login, but do not need to make API calls. It is a lightweight JavaScript based sign in solution.

You will find a couple of examples on how to implement them in this document.

Here are other resources that you can reference for technical insights.