Comments (15)
Perhaps it would be possible to use PAT authentication as well?
from rdrop2.
If possible, consider installing the latest GitHub version using devtools. There are a couple of bug fixes where the functions were attempting to read from the local oauth cache even though a token was being passed.
devtools::install_github("karthik/rdrop2")
It likely works locally because itβs reading the cached file (my guess).
Here is another suggestion.
In your script, add this line up top:
options("httr_oauth_cache" = TRUE)
Then upload the .httr-oauth
file that is saved locally when you authenticate on your local machine.
Let me know if that solves the issue. There are some changes coming in httr
soon that will hopefully remove this pain point.
from rdrop2.
Sounds good. I've been experimenting, and I do indeed think that the functions were reading from the local cache despite the token.
If I were to upload the .httr-oauth
file, would i need to encrypt it in the same way as you recommend doing with the .rds file?
from rdrop2.
I've been trying to make an R package that uses rdrop2 to access a private shared folder on Dropbox.
Then shouldn't the users authenticate to their own accounts? Is this for a shared account?
If I were to upload the .httr-oauth file, would i need to encrypt it in the same way as you recommend doing with the .rds file?
This only really works with travis at the moment.
from rdrop2.
Then shouldn't the users authenticate to their own accounts?
I hope that they will! I'm just trying to run some tests on Travis. Some of my functions can be tested with little MREs, but some would be best tested by accessing the original data. This would also alert me to when a user modifies original data in a way that breaks the package.
So I thought I'd pass to Travis my own (encrypted) authentication, and have it download and test the data from my dropbox. does that make sense? perhaps that is overkill?
from rdrop2.
I hope that they will! I'm just trying to run some tests on Travis.
Then yes! Use the information here: http://docs.travis-ci.com/user/encrypting-files/
You can see my .travis.yml
decrypting my keys (note: It wont work on pull requests for security reasons). https://github.com/karthik/rdrop2/blob/master/.travis.yml#L4-L5
hat tip to @jennybc for the tip.
from rdrop2.
Trying this approach with options("httr_oauth_cache" = TRUE)
, and unfortunately no joy. I tested with drop_acc()
(to see if it could even read the .httr-oauth
file) and i get:
> drop_acc()
error
1 OAuth 2 "Authorization" header is not well-formed.
from rdrop2.
damn π
Sorry, I'm currently away at a wedding till Friday with limited internet. Let me work through this and post a working solution as soon as I can.
from rdrop2.
Hi Karthik,
Don't worry too much. I can work around this. Just a few points so you know where I'm coming from when you start digging:
- That error about the "header is not well-formed." went away when I deleted my
.httr-oauth
and rerandrop-acc()
. I think I might have moved the authentication file around; could that be part of the problem? - I've switched to imitating you (encrypting the
.httr-oauth
file, rather than a token saved to.rds
). with the (unimportant?) difference that the encrypted file is in root of the directory, the unencrypted target is intests/testthat/.httr-oauth
. travis yml.
from rdrop2.
Is your package somewhere we can see it?
from rdrop2.
Yes! https://github.com/SrivastavaLab/bwgtools
from rdrop2.
@aammd I am surprised I don't see you explicitly loading the token in your test setup. Looking at this part of the README here:
https://github.com/karthik/rdrop2#accessing-dropbox-on-shiny-and-remote-servers
I see a workflow for saving a token β¦ reloading it β¦ then feeding it back to rDrop2
. I think you need to do that, instead of dealing with the .httr-oauth
file that is left behind from normal interactive usage.
You probably want tests/testthat/helper.R
file with a line that reads the token back in from the .rds
file. You should have a test helper script that does something like this:
(from right around the time we first got oauth working on travis)
https://github.com/jennybc/googlesheets/blob/8b53d5f9a229885668110ce22b9166e69221ddf8/tests/testthat/helper02_login.R
or this
(now, where package includes actual support for user-provided token)
https://github.com/jennybc/googlesheets/blob/e4798aa41cd52371944fdcc17b42a08fe58c62ae/tests/testthat/helper02_login.R
I don't think we ever encrypted/decrypted a .httr-oauth
file on travis. We did this with the token itself, which is subtly different. .httr-oauth
files are meant to hold multiple tokens, stored according to a hash. And I imagine what you're trying to do does not play nicely with the hash. You need to work directly with the token.
from rdrop2.
I should add that @karthik himself seems to have a .httr-auth
based strategy working for the rDrop2
tests, so I might be off-base above. But it gives you something to try. See this example test function in another thread: #22 (comment)
from rdrop2.
Hi Andrew,
I am having similar issue #61
Any suggestion to get this working?
Thanks,
Rohan
from rdrop2.
@rohan19250 I am also experiencing similar issues -- drop_delete the .httr-oauth file rather than the token stored as rds.
Have you found a solution by now?
from rdrop2.
Related Issues (20)
- BUG: drop_upload() does not return 'response'
- WISH: Completely silent calls
- Specify paths with shared_folder_id HOT 1
- dropbox_save with rdrop2? HOT 2
- Is there any way to use shinyWidgets/shinyhttr along with drop_download() to reflect the progress for downloads? HOT 1
- Documentation for drop_download shows deprecated function in examples
- Auth without a .rds file : is it possible? HOT 1
- Dropbox API Version 2 Updates HOT 2
- drop_delete with dtoken
- drop_share returning "Conflict (HTTP 409)" for some files not yet shared
- drop_upload() not works with ".wav" file
- drop_read : wrapper function for readxl, readRDS, load and readcsv
- drop_auth() generating short lived tokens HOT 13
- Request for autoretry (errors with http 429)
- Token auto-refresh hangs on windows machine HOT 2
- drop_copy / drop_move moving entire file path, not just the selected file
- expired_access_token HOT 1
- Archival on Cran HOT 1
- A version of this package for your version of R might be available elsewhere HOT 3
- Less of a question and more of a comment
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rdrop2.