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

Validate user-input API key #46

Closed
2 tasks
dlebauer opened this issue Jun 24, 2020 · 4 comments
Closed
2 tasks

Validate user-input API key #46

dlebauer opened this issue Jun 24, 2020 · 4 comments
Assignees

Comments

@dlebauer
Copy link
Member

dlebauer commented Jun 24, 2020

After the API key is entered in the Welcome page, it should be validated (#18)

  • check that API key is valid
    • select count(*) from users where apikey = $user_provided_apikey should return 1
  • confirm that user name. Display the name returned by the following query:
    • `select name from users where apikey = $user_provided_apikey
@im-prakher
Copy link
Contributor

@dlebauer @KristinaRiemer While implementing the validation using the API key, I found that currently, the apikey column for the users table for every row (user) is empty and null.

As by performing this query,
select count(*) from users where apikey = $user_provided_apikey it will return 0.

The app initializes the bety database from this URL, https://terraref.ncsa.illinois.edu/bety/dump/bety0/bety.tar.gz , so, if you can update the users table here with apikey, this query might work.

For now, should I perform validation based on the user's email in the database?.

@KristinaRiemer
Copy link
Contributor

So you checked that all api keys are null with something like select distinct(apikey) from users;?

I'm not really sure why the apikeys aren't showing up. When I log into my TERRA REF Bety account, I can see my own key under users. @dlebauer?

@dlebauer
Copy link
Member Author

dlebauer commented Aug 26, 2020

For the purposes of developing the functionality, feel free to use something like update users set apikey = 'whatever_random_string' where user = 'myuser';.

Instructions for generating api keys are here: https://pecan.gitbook.io/betydb-data-access/api-for-url-based-queries#for-administrators. There is also a button in the interface where users can generate / recreate their own apikeys.

@im-prakher
Copy link
Contributor

Done in #69

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

3 participants