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

1491: Add api token feature #1607

Merged
merged 12 commits into from
Sep 24, 2024
Merged

1491: Add api token feature #1607

merged 12 commits into from
Sep 24, 2024

Conversation

ztefanie
Copy link
Member

@ztefanie ztefanie commented Aug 29, 2024

Short description

Add possibility to add and delete tokens and to view metadata of the tokens. Tests will be done in #1618

Proposed changes

  • Added new database table for tokens
  • added three graphql endpoints
  • added api token section in administration settings for koblenz and project admins

Testing

login as a koblenz project admin. go to settings, create and delete tokens.

Resolved issues

Fixes: #1491

@ztefanie ztefanie marked this pull request as ready for review September 4, 2024 06:31
@f1sh1918
Copy link
Contributor

f1sh1918 commented Sep 11, 2024

Just tested the implementation and it works fine 👍
Before reviewing it i want to discuss some general things (we also might improve in the future):

  1. It might make sense to add a token name like in git so you can distinguish between the tokens.
  2. Then we could display this instead "Email des Erstellers" because its always the same and doesn't bring any value to show it.
  3. I think an creation date would be good and also display sth like "Added on
  4. Before deleting the token i would expect an Alert like "Do you really want to delete this". We already have a component for that can be easily used.
  5. A copy paste field where the generated token is displayed and can be copied via one click on it without missing sth by selecting.

And could you please resolve the migration conflicts :)

@ztefanie
Copy link
Member Author

Just tested the implementation and it works fine 👍 Before reviewing it i want to discuss some general things (we also might improve in the future):

  1. It might make sense to add a token name like in git so you can distinguish between the tokens.
  2. Then we could display this instead "Email des Erstellers" because its always the same and doesn't bring any value to show it.
  3. I think an creation date would be good and also display sth like "Added on
  4. Before deleting the token i would expect an Alert like "Do you really want to delete this". We already have a component for that can be easily used.
  5. A copy paste field where the generated token is displayed and can be copied via one click on it without missing sth by selecting.

And could you please resolve the migration conflicts :)

Yes these are all valid improvments, but I though we somehow agreed an a minimum usable feature and not a very good one, as it will only be used by very few people very rarly. So i think the solution I suggested is good enough and a lot more is not covered by our offer.

@f1sh1918
Copy link
Contributor

f1sh1918 commented Sep 11, 2024

Just tested the implementation and it works fine 👍 Before reviewing it i want to discuss some general things (we also might improve in the future):

  1. It might make sense to add a token name like in git so you can distinguish between the tokens.
  2. Then we could display this instead "Email des Erstellers" because its always the same and doesn't bring any value to show it.
  3. I think an creation date would be good and also display sth like "Added on
  4. Before deleting the token i would expect an Alert like "Do you really want to delete this". We already have a component for that can be easily used.
  5. A copy paste field where the generated token is displayed and can be copied via one click on it without missing sth by selecting.

And could you please resolve the migration conflicts :)

Yes these are all valid improvments, but I though we somehow agreed an a minimum usable feature and not a very good one, as it will only be used by very few people very rarly. So i think the solution I suggested is good enough and a lot more is not covered by our offer.

ok then just two small things.
The colors of the font and background of the token are in a really bad contrast. I suggest just use to use some border. And lets keep the token and the label New Token separate so copying is easier. Thats no big issue to adjust

My color suggestion for a good contrast:
image

Ah and according to 2) i didn't realized that they are project not user based so thats fine

Copy link
Contributor

@f1sh1918 f1sh1918 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work! 👍
Tested and works fine
Added some comments but nothing crucial

# Conflicts:
#	backend/src/main/kotlin/app/ehrenamtskarte/backend/migration/migrations/MigrationsRegistry.kt
Copy link
Contributor

@seluianova seluianova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me in general! Added a few suggestions.

Also, I agree with Andy regarding the confirmation dialog before deletion and I think it might be important if Koblenz stores a token in some app config for example. Then if they accidentally delete it, they might have to redeploy their app.
Not sure if it's a plausible case though.
What do you think?

Copy link
Contributor

@seluianova seluianova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looks nice to me

Copy link
Contributor

@f1sh1918 f1sh1918 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works great! Nice 👍
Just some small things

@ztefanie ztefanie merged commit d5e68de into main Sep 24, 2024
1 check passed
@ztefanie ztefanie deleted the 1491-add-api-token-feature branch September 24, 2024 06:56
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

Successfully merging this pull request may close these issues.

Add a possibility to create a token for api requests
3 participants