Code Monkey home page Code Monkey logo

Comments (10)

brendan-r avatar brendan-r commented on July 3, 2024

Hmm. Thanks for the detailed report, though unfortunately I can't reproduce. My hunch is that authentication is failing for you.

Please try:

  • Updating to the latest version install.packages("boxr"), and re-test
  • If the problem persists, please include the message returned by box_auth() (do redact any personal information you like). Your error message is consistent with the auth step not completing successfully.

Brendan

from boxr.

austintrombley avatar austintrombley commented on July 3, 2024

Should I download this again and try?

from boxr.

austintrombley avatar austintrombley commented on July 3, 2024

image

from boxr.

brendan-r avatar brendan-r commented on July 3, 2024

Yes, please update to the latest version.

The problem may be that you are not running an 'interactive session' (you're using Rscript), and box_auth assumes that you are. The appropriate setting in this case would be box_auth(interactive = FALSE). Let me know what you see when you try that.

from boxr.

austintrombley avatar austintrombley commented on July 3, 2024

Brendan,

I thought this might fix it – and I have tried this a few ways, still says it needs a listener?

require(boxr)

BOX_CLIENT_ID = “po1imyvnod3i…."
BOX_CLIENT_SECRET = “IGk9ojEO9TK….."
box_auth(client_id = “po1imyvnod3….", client_secret = “IGk9ojEO9….",interactive=FALSE)
[cid:990B2873-50AE-4BFB-8A95-36571CDCE7B8]

regards,
Austin D. Trombley, MBA
Senior Manager – Business Intelligence
cell: 415-767-6179
[cid:[email protected]]http://www.prosper.com/

From: Brendan Rocks <[email protected]mailto:[email protected]>
Reply-To: brendan-r/boxr <[email protected]mailto:[email protected]>
Date: Thursday, April 7, 2016 at 10:43 PM
To: brendan-r/boxr <[email protected]mailto:[email protected]>
Cc: Austin Trombley <[email protected]mailto:[email protected]>
Subject: Re: [brendan-r/boxr] running BoxR from command line - Error in cont$type : $ operator is invalid for atomic vectors (#46)

Yes, please update to the latest version.

The problem may be that you are not running an 'interactive session' (you're using Rscript), and box_auth assumes that you are. The appropriate setting in this case would be box_auth(interactive = FALSE). Let me know what you see when you try that.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHubhttps://github.com//issues/46#issuecomment-207225002

CONFIDENTIALITY STATEMENT: This email message, together with all attachments, is intended only for the individual or entity to which it is addressed and may contain legally privileged or confidential information. Any dissemination, distribution or copying of this communication by persons or entities other than the intended recipient, is strictly prohibited, and may be unlawful. If you have received this communication in error please contact the sender immediately and delete the transmitted material and all copies from your system, or if received in hard copy format, return the material to us via the United States Postal Service. Thank you.

from boxr.

brendan-r avatar brendan-r commented on July 3, 2024

Let me know if this works:

  • Remove interactive = FALSE from box_auth()
  • Run your script in an 'interactive mode' (e.g. in Rstudio, or the R console if you're on Windows). The script just needs to get as far as box_auth(). You are likely to be prompted to log-in to your account via a web-browser.
  • Re-run your script via Rscript

Rationale: Under the hood, OAuth2.0 (the standard which box.com uses to authenticate your account) requires that you have something called a 'token', which is a file sent from box.com stored on your machine. To get this, you need to submit your client_id and client_secret and then sign in via a web-browser. A token file is then stored (by default) at ~/.boxr-oauth.

If you're not in an interactive session (e.g. using Rscript) then R/httpuv cannot launch a browser, which means you cannot generate a token. However, by running an interactive session first, the token should be generated on your machine. This means that a non-interactive session can find and 'refresh' the token, without the necessity for the browser validation part.

Let me know if this solves your problem. I should investigate more informative error messages for this case.

from boxr.

austintrombley avatar austintrombley commented on July 3, 2024

Brendan,

I ran the script from Rstudio, and it ran fine. However, when I run it again from command line with box_auth(interactive=FALSE) I still get the same error:
box_auth()
Reading client id from .Renviron
Reading client secret from .Renviron
Auto-refreshing stale OAuth token.
boxr: Authenticated at box.comhttp://box.com/ as Austin Trombley ([email protected]:[email protected])

#box_fresh_auth()

#install.packages("boxr")
#library(boxr)
#box_fresh_auth()

setwd("C:/Users/atrombley/Desktop/Projects/cost_data_upload")
box_dl("33618399925", overwrite=TRUE)
|======================================================================================================| 100%[1] "C:\Users\atrombley\Desktop\Projects\cost_data_upload\Data_Pull.xlsx"

fn <- "C:/Users/atrombley/Desktop/Projects/cost_data_upload/Data_Pull.xlsx"

file.infohttp://file.info/(fn)
size isdir mode mtime
C:/Users/atrombley/Desktop/Projects/cost_data_upload/Data_Pull.xlsx 996930 FALSE 666 2016-04-08 14:12:15
ctime atime exe
C:/Users/atrombley/Desktop/Projects/cost_data_upload/Data_Pull.xlsx 2016-01-14 11:12:42 2016-01-14 11:12:42 no

require(XLConnect)
require(RCurl)
Loading required package: RCurl
Loading required package: bitops
require(RODBC)
Loading required package: RODBC
require(DBI)
Loading required package: DBI
require(RSQLite)
Loading required package: RSQLite
require(sqldf)
Loading required package: sqldf
Loading required package: gsubfn
Loading required package: proto
Attaching package: ‘gsubfn’
The following object is masked ​_by_​ ‘.GlobalEnv’:
fn
#rm(wb)
wb = loadWorkbook(fn,create=TRUE)
df <- readWorksheet(wb, sheet = "sheet2", header = TRUE)
head(df)
Name Date Refac Refmc Refd.cmhttp://refd.cm/ Cost Impressions Clicks Avg..Position Approvals
1 Brand Terms [search] 2015-01-01 KMMECNT YUEJO 679.12 4108 608 1.2 16
2 Brand Terms [search] 2015-01-02 KMMECNT YUEJO 1319.00 4489 1057 1.3 41
3 Brand Terms [search] 2015-01-03 KMMECNT YUEJO 1047.04 3617 849 1.3 28
4 Brand Terms [search] 2015-01-04 KMMECNT YUEJO 892.82 3446 743 1.3 15
5 Brand Terms [search] 2015-01-05 KMMECNT YUEJO 1801.49 5493 1302 1.3 30
6 Brand Terms [search] 2015-01-06 KMMECNT YUEJO 1649.91 5687 1299 1.3 51
Listings
1 16
2 41
3 28
4 15
5 30
6 51

———————————————————————————————————————
Ran from command line:

[cid:AD58BD95-021C-4D28-B966-5CEDFEE13650]
regards,
Austin D. Trombley, MBA
Senior Manager – Business Intelligence
cell: 415-767-6179
[cid:[email protected]]http://www.prosper.com/

From: Brendan Rocks <[email protected]mailto:[email protected]>
Reply-To: brendan-r/boxr <[email protected]mailto:[email protected]>
Date: Friday, April 8, 2016 at 12:53 PM
To: brendan-r/boxr <[email protected]mailto:[email protected]>
Cc: Austin Trombley <[email protected]mailto:[email protected]>
Subject: Re: [brendan-r/boxr] running BoxR from command line - Error in cont$type : $ operator is invalid for atomic vectors (#46)

Let me know if this works:

  • Remove interactive = FALSE from box_auth()
  • Run your script in an 'interactive mode' (e.g. in Rstudio, or the R console if you're on Windows). The script just needs to get as far as box_auth(). You are likely to be prompted to log-in to your account via a web-browser.
  • Re-run your script via Rscript

Rationale: Under the hood, OAuth2.0 (the standard which box.com uses to authenticate your account) requires that you have something called a 'token', which is a file sent from box.com stored on your machine. To get this, you need to submit your client_id and client_secret and then sign in via a web-browser. A token file is then stored (by default) at ~/.boxr-oauth.

If you're not in an interactive session (e.g. using Rscript) then R/httpuv cannot launch a browser, which means you cannot generate a token. However, by running an interactive session first, the token should be generated on your machine. This means that a non-interactive session can find and 'refresh' the token, without the necessity for the browser validation part.

Let me know if this solves your problem. I should investigate more informative error messages for this case.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHubhttps://github.com//issues/46#issuecomment-207576677

CONFIDENTIALITY STATEMENT: This email message, together with all attachments, is intended only for the individual or entity to which it is addressed and may contain legally privileged or confidential information. Any dissemination, distribution or copying of this communication by persons or entities other than the intended recipient, is strictly prohibited, and may be unlawful. If you have received this communication in error please contact the sender immediately and delete the transmitted material and all copies from your system, or if received in hard copy format, return the material to us via the United States Postal Service. Thank you.

from boxr.

brendan-r avatar brendan-r commented on July 3, 2024

That's not the same error. The text appears to show you authenticating successfully, and the output of R code running, no..?

from boxr.

austintrombley avatar austintrombley commented on July 3, 2024

I have reduced the code now to just two lines to show the issue (it runs fine from interactive window).

require(boxr)
box_auth()

----->
Loading required package: boxr
Welcome to boxr 0.2.9!
Bug reports: https://github.com/brendan-R/boxr/issues

See vignette('boxr') for a short guide on connecting your box.com account to R.
Please enter your box client id. If you don't have one
see the documentation at ?box_auth, and hit ENTER to exit.

NULL
Error: oauth_listener() needs an interactive environment.
Execution halted


require(boxr)
box_auth(interactive=FALSE)
----->
Loading required package: boxr
Welcome to boxr 0.2.9!
Bug reports: https://github.com/brendan-R/boxr/issues

See vignette('boxr') for a short guide on connecting your box.com account to R.
Error in box_auth(interactive = FALSE) :
box.com authorization unsuccessful; client id and/or secret not found.
See ?box_auth for help!

Execution halted

require(boxr)
box_auth(client_id = "po1imyvnod3iyl4ysan......", client_secret = "IGk9ojEO9TKeHN......",interactive=FALSE)
----->

Loading required package: boxr
Welcome to boxr 0.2.9!
Bug reports: https://github.com/brendan-R/boxr/issues

See vignette('boxr') for a short guide on connecting your box.com account to R.
Error: oauth_listener() needs an interactive environment.
Execution halted

from boxr.

brendan-r avatar brendan-r commented on July 3, 2024

Hey Austin,

Assuming you got this working in the end. Closing this issue for the time being.

from boxr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.