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

initialize_sciencebase_session() token copy-paste not working, likely because multi-line JSON token not accepted #317

Closed
msleckman opened this issue Dec 21, 2023 · 3 comments

Comments

@msleckman
Copy link

msleckman commented Dec 21, 2023

I am running into an error with the updated approach to authenticating sb for code dev in R.
I am following to approach outlined here.

After successfully entering into sciencebase.gov with bisonconnect and getting access to the API token when I run initialize_sciencebase_session, I copy and enter the token into the popup in R for the token string but I get the following JSON parsing error.

> initialize_sciencebase_session(user) 
A browser will open https://sciencebase.usgs.gov/manager/ 
Log in and copy a token from the 'User' menu in the upper right.
Paste the token in the dialogue box that opens. 
Error : parse error: premature EOF
                                       {
                     (right here) ------^ 
[1] FALSE

The error points to the fact that it doesn't like that the JSON token is multi-string. And, indeed, when I go in and manually fix the json token code so that it is not multi-line : I ensure the first { is right before "access_token" without a space inbetween and also remove the new line and the extra spaces before "refresh_token".

I know updated have been happening throughout, so I've re-installed sbtools (and tested with teh dev version) and this same error occurs.

Would like to avoid having the manually edit the token string in text editor before entering in to authenticate sb.

@dblodgett-usgs
Copy link
Collaborator

Thanks for the report, this works on my install of rstudio on Windows. What operating system are you on? Are you working on the command line?

@msleckman
Copy link
Author

I'm on mac OS. I primarily use the terminal in R Studio.

@dblodgett-usgs
Copy link
Collaborator

One of the sciencebase team members just switched it to a single line. You may need to force refresh the manager where you get the token to get it to work.

dblodgett-usgs added a commit that referenced this issue Jan 17, 2024
improve token handling. related to #317, #318, and #319.
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

2 participants