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

Unable to CreateConnection: invalid credentials, but login/password work via web portal #99

Closed
cashoes opened this issue May 6, 2019 · 11 comments

Comments

@cashoes
Copy link

cashoes commented May 6, 2019

Re-running through a bit of analysis that used to work. I get an error when trying to create a connection.

Error in .CreateConnection(study = study, labkey.url.base = labkey.url.base, :
Invalid credential or deactivated account. Check your account in the portal.

Credentials appear to be valid when accessing ImmuneSpace via the web portal. This is using R 3.5 running on a Windows machine.

Steps taken:

  • Reset my password on the portal and tried again after restarting my R instance and updating my _netrc file.
  • That's pretty much it...
@juyeongkim
Copy link
Member

What's the version of ImmuneSpaceR you are using?

packageVersion("ImmuneSpaceR")

@cashoes
Copy link
Author

cashoes commented May 6, 2019 via email

@juyeongkim
Copy link
Member

Try installing the latest development version of ImmuneSpaceR:

remotes::install_github("RGLab/ImmuneSpaceR")

And update your netrc file via:

ImmuneSpaceR::interactive_netrc()

Your netrc should be located at:

"C:/Users/yourUsername/Documents/_netrc"

And it should look something like this:

machine www.immunespace.org
login  [email protected]
password  yourPassword

@cashoes
Copy link
Author

cashoes commented May 6, 2019

Thanks - updated to 1.11.7, but I still get the same problem.

I don't know if this will help, but running:
ImmuneSpaceR::check_netrc()

Fails with:
Error in ImmuneSpaceR::check_netrc() : There is no netrc file. Use write_netrc

Apparently because it checks for a '.netrc' in the home folder (hardcoded - not platform dependent). Is this function called internally by CreateConnection() at all?

@juyeongkim
Copy link
Member

Gotcha. Yeah that's a bug. It shouldn't be hardcoded like that. Thanks! We will fix that. But no it's not called internally by CreateConnection().

I am thinking something is wrong in netrc file. How did you create your netrc file? Have you tried interactive_netrc()?

The alternative way to create a connection is to pass your credentials in CreateConnection() call:

con <- CreateConnection("", login = "[email protected]", password = "yourSecretPassword")

@cashoes
Copy link
Author

cashoes commented May 6, 2019

Yes, I did try interactive_netrc(), the information within is correct (as in, it is the same as the email and password that allow me to log in through the web portal). Overwriting and rewriting the same information (or selecting no and doing nothing) results in:

Validating netrc ... Cannot connect to ImmuneSpace with current netrc information -- check login and password for errors

I also tried directly passing my username (I used email address?) and password to CreateConnection and still get invalid credentials, so I'm totally stumped at this point. Seems my credentials aren't valid... but the web portal seems ok with them.

@juyeongkim
Copy link
Member

That is really weird. I'm really sorry about this.

Could you try this and share the output?

httr::GET("https://www.immunespace.org/login-whoami.view", Rlabkey:::labkey.getRequestOptions())

@cashoes
Copy link
Author

cashoes commented May 6, 2019

Response [https://www.immunespace.org/login-whoami.view]
Date: 2019-05-06 22:50
Status: 200
Content-Type: application/json;charset=UTF-8
Size: 151 B
{
"displayName" : "casey",
"success" : true,
"id" : 1456,
"CSRF" : "d5966653f57cd8b39ad3b0307ceb339a",
"email" : "[email protected]"

@juyeongkim
Copy link
Member

Hmmmm strange. Your netrc file seems to be valid, and CreateConnection shouldn't be giving the invalid credential error since that response is neither 401 status or returning as guest. https://github.com/RGLab/ImmuneSpaceR/blob/master/R/ISCon.R#L496

I just checked your account permissions, and they are good. I am running out of ideas at this point.

  • Do you have labkey.url.base variable defined in global environment by any chance? If so, remove it and try again.
  • Update Rlabkey, httr, and curl packages to the latest version and try again.
  • Sometimes curl doesn't pick up the updated netrc file. Restart your R session and try again in fresh R session.

I apologize for the inconvenience and thank you for your patience.

@cashoes
Copy link
Author

cashoes commented May 6, 2019

Thanks for your patience... labkey.url.base was the guilty party. Since RStudio restores the last project on open, the variable was globally defined everytime I restarted.

I was using an .Rmd that Evan Henrich shared with me a few weeks ago which included setting up `labkey.url.base' globally to access the test server... I guess that's not something I have access to with my personal credentials.

Thanks for all your help with this.

@juyeongkim
Copy link
Member

Gotcha. I am glad I was able to help. Let me know if you run into more issues with ImmuneSpace or ImmuneSpaceR or have any suggestions. Thank you!

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