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

user() giving me an error after the authentication #65

Closed
Bhashitha2014 opened this issue Apr 15, 2024 · 11 comments
Closed

user() giving me an error after the authentication #65

Bhashitha2014 opened this issue Apr 15, 2024 · 11 comments

Comments

@Bhashitha2014
Copy link

error_message

As mentioned in the documentation, I was able to generate the token from https://api.opengwas.io/profile/ and updated it in .Renviron. In addition, I was able to confirm the token with ieugwasr::get_opengwas_jwt(). However, user() function is giving an error. When I tried to fetch the data from the server, I am getting an error ..

error_2
@Bhashitha2014
Copy link
Author

error with user()

@jekriske-lilly
Copy link

This error is caused by the if block at https://github.com/MRCIEU/ieugwasr/blob/master/R/query.R#L91-L96 not being checked for an error first like the if blocks above it within in the while loop.

It also doesn't appear that the JWT stuff is fully implemented yet so it's not going to work anyway without changing this around
https://github.com/MRCIEU/ieugwasr/blob/master/R/query.R#L26-L27

The third issue is that we block the new API URL, but we'll deal with that internally.

Once @explodecomputer is finished with the 1.0 release I'm sure this will all work fine, it looks like he's still in progress.

@Bhashitha2014
Copy link
Author

Bhashitha2014 commented Apr 16, 2024

Is there anything that I can run from my end to fix this issue?

error_ieugwasr

@explodecomputer
Copy link
Collaborator

In the latest commit the user function should be working now, and I've made the change that @jekriske-lilly spotted (thanks for that). See if it fixes otherwise let me know what code you used to generate the error and I can have a look again.

@explodecomputer
Copy link
Collaborator

A quick note also to not share your token with others as it's essentially a password. You can reset the one posted above on the profile page.

@Bhashitha2014
Copy link
Author

Bhashitha2014 commented Apr 17, 2024

When I just followed the steps mentioned under the authentication step as mentioned below;

Authentication

  1. Login to https://api.opengwas.io/profile
  2. Generate a new token
  3. Add OPENGWAS_JWT=<token> to your .Renviron file. This file could be either in your home directory or in the working directory of your R session. You can check the location of your .Renviron file by running Sys.getenv("R_ENVIRON_USER") in R.
  4. Restart your R session
  5. To check that your token is being recognised, run ieugwasr::get_opengwas_jwt(). If it returns a long random string then you are authenticated.
  6. To check that your token is working, run user(). It will make a request to the API for your user information using your token. It should return a list with your user information. If it returns an error, then your token is not working.

However, I am still getting the error as mentioned.

@JasonQiu
Copy link

Please confirm you are using the latest version (0.2.2-9003 at time of writing) and also note #65 (comment)

@Bhashitha2014
Copy link
Author

Please confirm you are using the latest version (0.2.2-9003 at time of writing) and also note #65 (comment)

0.2.2.9002

@JasonQiu
Copy link

Detach and remove (you current) ieugwasr, then remotes::install_github("mrcieu/ieugwasr")

@Bhashitha2014
Copy link
Author

Detach and remove (you current) ieugwasr, then remotes::install_github("mrcieu/ieugwasr")

Thanks a lot! It is now resolved.

@remlapmot
Copy link
Collaborator

Yes - always detach packages before updating them - or simpler still just restart (close and reopen) your R session.

And remember you can install a prebuilt binary version for several different operating systems and architectures from https://mrcieu.r-universe.dev/builds

For Windows and Mac users

install.packages("ieugwasr", repos = c("https://mrcieu.r-universe.dev", "https://cran.r-project.org"))

For Ubuntu Jammy Jellyfish users

# Installation code for Ubuntu Jammy Jellyfish users running R in the Terminal
options(HTTPUserAgent = sprintf(
  "R/%s R (%s)",
  getRversion(),
  paste(getRversion(),
        R.version["platform"],
        R.version["arch"],
        R.version["os"])
))

install.packages(
  'ieugwasr',
  repos = c(
    'https://mrcieu.r-universe.dev/bin/linux/jammy/4.3/',
    'https://packagemanager.posit.co/cran/__linux__/jammy/latest',
    'https://cloud.r-project.org'
  )
)

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

5 participants