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

Authentication in shinyapps.io #9

Closed
Eflores89 opened this issue May 27, 2018 · 3 comments
Closed

Authentication in shinyapps.io #9

Eflores89 opened this issue May 27, 2018 · 3 comments

Comments

@Eflores89
Copy link

Eflores89 commented May 27, 2018

Hi, I am building an application hosted on shinyapps.io that sends an email. When running locally it works using use_secret_file however, this authentication does not seem to work on server in shinyapps.io (I upload the json file as well).

The error log indicates the following:
Please point your browser to the following url: https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fgmail.readonly%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fgmail.modify%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fgmail.compose%20https%3A%2F%2Fmail.google.com%2F&redirect_uri=http%3A%2F%2Flocalhost%3A1410%2F&response_type=code&state=BMX5xxbBjG

So it seems to not be using the file. Is there something I am missing in the way it is called inside the shiny session? Or any thoughts on how I can achieve this authentication? It seems to work fine with googlesheets (using gs_auth )

@jennybc
Copy link
Owner

jennybc commented May 27, 2018

The json file contains just the client id and secret, I believe, not an actual token. So you still need to make provision for an actual token on shinyapps.io. Presumably this is being stored in a .httr-oauth file locally and that needs to go with your app as well. Note that there are some security concerns with this. All will probably be fine, but I doubt shinyapps.io was built to be super protective of your source files.

@Eflores89
Copy link
Author

Ok I see, sorry to hassle but I can't seem to get it to work.

I have tried leaving the httr-oauth file in the directory, reading it in and using the "service option",

googleAuthR::gar_auth_service(json_file = "www/consulting-send-app-b4d8ece8370a.json", 
                              scope = "https://www.googleapis.com/auth/gmail.send")

But nothing seems to be working.

I am doing another authentication in the same shiny app for googlesheets using gs_auth, might that have an effect? Any ideas?

@jennybc
Copy link
Owner

jennybc commented May 27, 2018

I'm afraid I'm not up to speed on googleAuthR. It sounds like you're trying to use googlesheets, gmailR, and maybe some other google service, all in one app? I suspect gmailR requires or strongly suggests having its token in .httr-oauth. googlesheets has a way to store/retrieve token from an arbitrary .rds file (explained in vignette: https://cran.r-project.org/web/packages/googlesheets/vignettes/managing-auth-tokens.html). So gmailr and googlesheets shouldn't get in each other's way. Not sure where googleAuthR fits in.

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

No branches or pull requests

2 participants