ShinyApp - Dropbox authentication with rdrop2

三世轮回 提交于 2020-01-13 06:02:10

问题


I stored files on my dropbox and I am accessing them through rdrop2 on a shinyapp hosted at shinyapps.io. The following code works great on my laptop but aborts when I deploy my app on shinyapp.io and freezes an opaque screen. Any clues on why and how to troubleshoot? Thanks a bunch! - stephane

Here is the code I am using (from https://github.com/karthik/rdrop2):

  token<-drop_auth()
  saveRDS(token, "droptoken.rds")
  token <- readRDS("droptoken.rds")
  ZIPFile<-drop_read_csv(as.character(ZIPCode),sep="",dtoken=token)

And the ShinyApp log:

2015-10-16T17:55:46.965850+00:00 shinyapps[64206]: Warning: Unhandled error in observer: oauth_listener() needs an interactive environment.
2015-10-16T17:55:46.965853+00:00 shinyapps[64206]: observe({
2015-10-16T17:55:46.965854+00:00 shinyapps[64206]: if (input$Recalc < 1)
2015-10-16T17:55:46.965856+00:00 shinyapps[64206]: return()
2015-10-16T17:55:46.965857+00:00 shinyapps[64206]: ZIPCode <- isolate(input$NewZIP)
2015-10-16T17:55:46.965858+00:00 shinyapps[64206]: token <- drop_auth()
2015-10-16T17:55:46.965859+00:00 shinyapps[64206]: saveRDS(token, "droptoken.rds")
2015-10-16T17:55:46.965861+00:00 shinyapps[64206]: token <- readRDS("droptoken.rds")
2015-10-16T17:55:46.965862+00:00 shinyapps[64206]: ZIPFile <- drop_read_csv(as.character(ZIPCode), sep = "",
2015-10-16T17:55:46.965863+00:00 shinyapps[64206]: dtoken = token)


回答1:


Problem solved: had a fresh look at the instructions provided by rdrop2:

  1. The two first lines of code are to be done locally and once only:

    token<-drop_auth() saveRDS(token, "droptoken.rds")

  2. The file droptoken.rds is to be stored in the under the same folder structure than the one where the app is being developped.

  3. The two last lines of code are to be kept in the app:

    token<-drop_auth() saveRDS(token, "droptoken.rds")

This way when you deploy your app on a server, you're deploying also the token with it. Poses some security issues but I'll need to wait for a good set of instructions for oauth with dropbox under r.



来源:https://stackoverflow.com/questions/33177033/shinyapp-dropbox-authentication-with-rdrop2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!