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 on virtual machine #186

Open
cawthm opened this issue Sep 14, 2020 · 5 comments
Open

Authentication on virtual machine #186

cawthm opened this issue Sep 14, 2020 · 5 comments

Comments

@cawthm
Copy link

cawthm commented Sep 14, 2020

I'm trying to connect a virtual machine (ubuntu; command line via ssh/ no browser) to a newly-created dropbox scoped app.

For this app, I have a key, secret, and token, all taken from the Dropbox developer console page.

If I simply copy/ paste the token to my remote machine and run something like:

token <- "my_token_string" 
saveRDS(token, "drop_token.RDS)
rdrop2:: drop_auth(rdstoken = "drop_token.RDS")

...this does nothing.

The helpfile for the rdstoken argument to the drop_auth function says:

"In server environments where interactive OAuth is not possible, a token can be created on a desktop client and used in production."

The ReadMe says:

If you expect to access a Dropbox account via Shiny or on a remote cluster, EC2, Digital Ocean etc, you can leave the cached oauth file in the same directory, or pass the token explicitly to drop_auth. You can also save the output of drop_auth into an R object, sink that to disk, and pass that as a token.

So I have a token in hand, but I don't know how to pass it.

Something else I tried

From a local machine (ie with a browser), I attempted

drop_auth(new_user = F, key = MY_APP_KEY, secret = MY_APP_SECRET)

This results in the following error in a browser window (400 error):

_**"More details for developers

Invalid redirect_uri. It must exactly match one of the redirect URIs you've pre-configured for your app (including the path)."**_

Note that I've added both https://localhost and http://localhost as redirect URIs on the DB console.

Account Type

Dropbox Plus.

Session Info for the VM

> devtools::session_info()
─ Session info ───────────────────────────────────────────────────────────────
 setting  value                       
 version  R version 4.0.0 (2020-04-24)
 os       Ubuntu 18.04.4 LTS          
 system   x86_64, linux-gnu           
 ui       X11                         
 language (EN)                        
 collate  C.UTF-8                     
 ctype    C.UTF-8                     
 tz       Etc/UTC                     
 date     2020-09-14Packages ───────────────────────────────────────────────────────────────────
 package     * version date       lib source                         
 assertthat    0.2.1   2019-03-21 [1] CRAN (R 4.0.0)                 
 backports     1.1.6   2020-04-05 [1] CRAN (R 4.0.0)                 
 callr         3.4.3   2020-03-28 [1] CRAN (R 4.0.0)                 
 cli           2.0.2   2020-02-28 [1] CRAN (R 4.0.0)                 
 crayon        1.3.4   2017-09-16 [1] CRAN (R 4.0.0)                 
 desc          1.2.0   2018-05-01 [1] CRAN (R 4.0.0)                 
 devtools      2.3.0   2020-04-10 [1] CRAN (R 4.0.0)                 
 digest        0.6.25  2020-02-23 [1] CRAN (R 4.0.0)                 
 ellipsis      0.3.1   2020-05-15 [1] CRAN (R 4.0.0)                 
 fansi         0.4.1   2020-01-08 [1] CRAN (R 4.0.0)                 
 fs            1.4.1   2020-04-04 [1] CRAN (R 4.0.0)                 
 glue          1.4.2   2020-08-27 [1] CRAN (R 4.0.0)                 
 httr          1.4.2   2020-07-20 [1] CRAN (R 4.0.0)                 
 magrittr      1.5     2014-11-22 [1] CRAN (R 4.0.0)                 
 memoise       1.1.0   2017-04-21 [1] CRAN (R 4.0.0)                 
 pkgbuild      1.0.7   2020-04-25 [1] CRAN (R 4.0.0)                 
 pkgload       1.0.2   2018-10-29 [1] CRAN (R 4.0.0)                 
 prettyunits   1.1.1   2020-01-24 [1] CRAN (R 4.0.0)                 
 processx      3.4.2   2020-02-09 [1] CRAN (R 4.0.0)                 
 ps            1.3.2   2020-02-13 [1] CRAN (R 4.0.0)                 
 R6            2.4.1   2019-11-12 [1] CRAN (R 4.0.0)                 
 rdrop2        0.8.2.1 2020-09-12 [1] Github (karthik/rdrop2@6176b86)
 remotes       2.1.1   2020-02-15 [1] CRAN (R 4.0.0)                 
 rlang         0.4.7   2020-07-09 [1] CRAN (R 4.0.0)                 
 rprojroot     1.3-2   2018-01-03 [1] CRAN (R 4.0.0)                 
 sessioninfo   1.1.1   2018-11-05 [1] CRAN (R 4.0.0)                 
 testthat      2.3.2   2020-03-02 [1] CRAN (R 4.0.0)                 
 usethis       1.6.1   2020-04-29 [1] CRAN (R 4.0.0)                 
 withr         2.2.0   2020-04-20 [1] CRAN (R 4.0.0) 

@laresbernardo
Copy link

laresbernardo commented Sep 25, 2020

Hi @cawthm!
Add http://localhost:1410/ into your OAuth 2's Redirect URIs in Dropbox. Worked for me! It's still interactive (not programmatic 100%) but works.

@mkirzon
Copy link

mkirzon commented Oct 17, 2020

@laresbernardo thank you for that! That's exactly where I was stuck. What do you mean though that it's not programmatic?

@laresbernardo
Copy link

@mkirzon I mean you will still be redirected and will have to click/accept/interact with the UI manually. Don’t see how to run a script that authenticates and runs a task without having to save the token into an RDS file before to use it or manually interacting with the redirected site.

@fernandobastosneto
Copy link

It took me some time to find out what should I do in this situation. I've tried to add http://localhost:1410 to Redirect URIs but that did not work.

This link of a RStudio blog post shows the true (and sad) answer: just authenticate locally and then copy that damn token to your remote machine.

@mkirzon
Copy link

mkirzon commented Jan 26, 2021

I'm curiuos to read the blog post but I think you linked the wrong thing :)

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

4 participants