Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

Command line authentication #55

Closed
pkraker opened this issue Apr 24, 2018 · 4 comments
Closed

Command line authentication #55

pkraker opened this issue Apr 24, 2018 · 4 comments
Milestone

Comments

@pkraker
Copy link

pkraker commented Apr 24, 2018

OS: Ubuntu 14.04
R version: 3.4.0
Pacakge version: 0.4.2.9110

I am trying to run a script using rorcid with Rscript. I completed the following steps, but I always get the following error: Error: Unauthorized (HTTP 401)

  1. I registered an application with ORCiD with the redirect URL set to http://localhost
  2. I entered the client secret to my .Renviron-file by setting the variable ORCID_TOKEN

Where did I go wrong?

@sckott
Copy link
Contributor

sckott commented Apr 24, 2018

Sorry about the error. We've added docs on authentication here https://github.com/ropensci/rorcid/blob/master/R/auth.R#L11-L37

Can you run R interactively, and run orcid_auth(), then get the token out of that? Or does running orcid_auth()` not work when in R interactive session?

@pkraker
Copy link
Author

pkraker commented Apr 25, 2018

Thanks, running orcid_auth() did indeed do the trick! But I had to switch to a system that allows for an interactive session to obtain the token. In the terminal-only environment, orcid_auth() produced the following error:

> orcid_auth()
no ORCID token found; attempting OAuth authentication

Waiting for authentication in browser...
Press Esc/Ctrl + C to abort
/usr/bin/xdg-open: line 461: links2: command not found
/usr/bin/xdg-open: line 461: links: command not found
/usr/bin/xdg-open: line 461: lynx: command not found
/usr/bin/xdg-open: line 461: w3m: command not found
xdg-open: no method available for opening 'https://orcid.org/oauth/authorize?client_id=[...]

@sckott
Copy link
Contributor

sckott commented Apr 25, 2018

thanks for this, yeah we need to fail nicely when the user is in a context where a browser can no be opened

@sckott
Copy link
Contributor

sckott commented May 2, 2018

so i guess there's no way to open a browser in shell only env, so it can't work in that case. my smarter colleague tells me there's not really a way around this. So I guess we can at least document the pitfall

@sckott sckott added this to the v0.5 milestone May 2, 2018
@sckott sckott closed this as completed in 27bb4af May 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants