karthik / karthik/rdrop2

Shinyapps.io error: Warning: Error in : oauth_listener() needs an interactive environment.

Open
#48 3 comments 0 reactions 0 assignees View on GitHub
rdrop-0.7
Dominant language
R
Stars
253
Forks
60
PR merge metrics
No merged PRs in 30d

Description

Hi, when trying to pull data from my dropbox account for a shiny app I get this error. (shinyapps.io logs)

```
2016-03-19T23:18:38.148996+00:00 shinyapps[86118]: htmltools version: 0.3
2016-03-19T23:18:38.406392+00:00 shinyapps[86118]: Using jsonlite for JSON processing
2016-03-19T23:18:38.410372+00:00 shinyapps[86118]:
2016-03-19T23:18:38.410375+00:00 shinyapps[86118]: Starting R with process ID: '12'
2016-03-19T23:18:38.430300+00:00 shinyapps[86118]:
2016-03-19T23:18:38.430304+00:00 shinyapps[86118]: Listening on http://0.0.0.0:44020
2016-03-19T23:18:49.485827+00:00 shinyapps[86118]:
2016-03-19T23:18:49.485831+00:00 shinyapps[86118]: Attaching package: ‘dplyr’
2016-03-19T23:18:49.485832+00:00 shinyapps[86118]:
2016-03-19T23:18:49.486483+00:00 shinyapps[86118]: The following objects are masked from ‘package:stats’:
2016-03-19T23:18:49.486485+00:00 shinyapps[86118]:
2016-03-19T23:18:49.486487+00:00 shinyapps[86118]: filter, lag
2016-03-19T23:18:49.492350+00:00 shinyapps[86118]: The following objects are masked from ‘package:base’:
2016-03-19T23:18:49.492353+00:00 shinyapps[86118]:
2016-03-19T23:18:49.492354+00:00 shinyapps[86118]: intersect, setdiff, setequal, union
2016-03-19T23:18:49.492356+00:00 shinyapps[86118]:
2016-03-19T23:18:49.573106+00:00 shinyapps[86118]:
2016-03-19T23:18:49.573111+00:00 shinyapps[86118]: Attaching package: ‘magrittr’
2016-03-19T23:18:49.573112+00:00 shinyapps[86118]:
2016-03-19T23:18:49.573392+00:00 shinyapps[86118]: The following object is masked from ‘package:tidyr’:
2016-03-19T23:18:49.486488+00:00 shinyapps[86118]:
2016-03-19T23:18:49.573394+00:00 shinyapps[86118]: extract
2016-03-19T23:18:49.642772+00:00 shinyapps[86118]: Warning: Error in : oauth_listener() needs an interactive environment.
2016-03-19T23:18:49.649738+00:00 shinyapps[86118]: 62: oauth_listener
2016-03-19T23:18:49.649739+00:00 shinyapps[86118]: 61: init_oauth2.0
2016-03-19T23:18:49.649741+00:00 shinyapps[86118]: 60: self$init_credentials
2016-03-19T23:18:49.649742+00:00 shinyapps[86118]: 59: public_bind_env$initialize
2016-03-19T23:18:49.649743+00:00 shinyapps[86118]: 58: Token2.0$new
2016-03-19T23:18:49.649744+00:00 shinyapps[86118]: 57: httr::oauth2.0_token
2016-03-19T23:18:49.649736+00:00 shinyapps[86118]: Stack trace (innermost first):
2016-03-19T23:18:49.573395+00:00 shinyapps[86118]:
2016-03-19T23:18:49.573393+00:00 shinyapps[86118]:
2016-03-19T23:18:49.649749+00:00 shinyapps[86118]: 52: source
2016-03-19T23:18:49.649751+00:00 shinyapps[86118]: 12: fn
2016-03-19T23:18:49.649745+00:00 shinyapps[86118]: 56: drop_auth
2016-03-19T23:18:49.649753+00:00 shinyapps[86118]: 10: tryCatchOne
2016-03-19T23:18:49.649746+00:00 shinyapps[86118]: 55: eval [helper.R#11]
2016-03-19T23:18:49.649755+00:00 shinyapps[86118]: 8: tryCatch
2016-03-19T23:18:49.649756+00:00 shinyapps[86118]: 7: connect$retry
2016-03-19T23:18:49.649750+00:00 shinyapps[86118]: 13: runApp
2016-03-19T23:18:49.649747+00:00 shinyapps[86118]: 54: eval
2016-03-19T23:18:49.649748+00:00 shinyapps[86118]: 53: withVisible
2016-03-19T23:18:49.649762+00:00 shinyapps[86118]: 1: local
2016-03-19T23:18:49.649790+00:00 shinyapps[86118]: Error : oauth_listener() needs an interactive environment.
2016-03-19T23:18:49.649752+00:00 shinyapps[86118]: 11: doTryCatch
2016-03-19T23:18:49.649760+00:00 shinyapps[86118]: 3: eval
2016-03-19T23:18:49.649754+00:00 shinyapps[86118]: 9: tryCatchList
2016-03-19T23:18:49.649757+00:00 shinyapps[86118]: 6: eval
2016-03-19T23:18:49.649758+00:00 shinyapps[86118]: 5: eval
2016-03-19T23:18:49.649759+00:00 shinyapps[86118]: 4: eval
2016-03-19T23:18:49.649761+00:00 shinyapps[86118]: 2: eval.parent
```

This are the lines of code (on an already authenticated `rdrop2` token) I try to run:

```
token <- readRDS('droptoken.rds')

list_files <- data.frame(name = gsub(".*\\/(.*)\\..*", "\\1",
drop_dir(drop_search('RData')[7,]$path)$path),
path = drop_dir(drop_search('RData')[7,]$path)$path,
stringsAsFactors = FALSE)
```

As you can see, the token is already stored in the same folder with the `.R` files I am trying to run.

I am using the `Publish to Server` function in the RStudio IDE.

Contributor guide

Open the contributing guide

Research direction

Start with helper.R#11 and trace the call from drop_auth through httr::oauth2.0_token and oauth_listener. Check how the stored droptoken.rds is used when the app is deployed with RStudio's Publish to Server; done means the deployed Shiny app can access Dropbox without requiring an interactive environment.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
authentication
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.