ShinyApp-使用rdrop2的Dropbox身份验证 [英] ShinyApp - Dropbox authentication with rdrop2

查看:141
本文介绍了ShinyApp-使用rdrop2的Dropbox身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将文件存储在我的保管箱中,并且正在通过Shinyapps.io托管的Shinyapp上的rdrop2访问它们。以下代码可在笔记本电脑上很好地工作,但是当我在Shinyapp.io上部署应用程序并冻结不透明的屏幕时会中止。关于为什么以及如何进行故障排除的任何线索?谢谢一群! -stephane



这是我正在使用的代码(来自 https://github.com/karthik/rdrop2 ):

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

ShinyApp日志


2015-10-16T17:55:46.965850 + 00:00 Shinyapps [64206]:警告:观察者中未处理的错误:oauth_listener ()需要一个交互式环境

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<-隔离(input $ NewZIP)

2015-10-16T17:55:46.965858 + 00:00 Shinyapps [64206]:令牌<-drop_auth()

2015-10-16T17:55:46.965859 + 00 :00 Shinyapps [64206]:saveRDS(令牌, droptoken.rds)

2015-10-16T17:55:46.965861 + 00:00 Shinyapps [64206]:令牌<-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 =令牌)



解决方案

问题已解决:重新看了rdrop2提供的指令:


  1. 前两行代码只能在本地完成,并且只能执行一次:


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



  2. droptoken.rds文件存储在与正在开发应用程序的文件夹相同的文件夹结构下。 p>


  3. 最后两行代码将保留在应用程序中:


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



这样,当您在服务器上部署应用程序时,还有它的令牌。带来了一些安全问题,但我需要等待一组关于r下的Dropbox的oauth的良好指导。


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)

解决方案

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 developed.

  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.

这篇关于ShinyApp-使用rdrop2的Dropbox身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆