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

feat: user can create api keys #329

Conversation

mattzcarey
Copy link
Contributor

Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context.

Create and use API keys
#315

Checklist before requesting a review

Please delete options that are not relevant.

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented hard-to-understand areas
  • I have ideally added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged

Screenshots (if appropriate):

@mattzcarey mattzcarey linked an issue Jun 14, 2023 that may be closed by this pull request
@vercel
Copy link

vercel bot commented Jun 14, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 14, 2023 4:41pm
quivrapp ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 14, 2023 4:41pm

…ey-with-the-fe-for-quivr' of https://github.com/StanGirard/quivr into 315-api-key-gen-aauser-i-can-create-and-delete-an-api-key-with-the-fe-for-quivr
Copy link
Collaborator

@StanGirard StanGirard left a comment

Choose a reason for hiding this comment

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

Great PR !

I'm in the subway and will test once I'm back

Comment on lines 20 to 22
<ConfigForm />
<ApiKeyConfig />
</section>
Copy link
Contributor

Choose a reason for hiding this comment

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

<ApiKeyConfig /> should maybe go to <ConfirmForm />, just before <UserAccountSection />, since <ModelConfig/> and <BackendConfig /> are already there


class JWTBearer(HTTPBearer):
class AuthBearer(HTTPBearer):
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice job! i like this validator logic

Comment on lines 34 to 36
return await get_user_from_api_key(token, commons)
else:
raise HTTPException(status_code=402, detail="Invalid token or expired token.")
Copy link
Contributor

Choose a reason for hiding this comment

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

The returned message should maybe be more personalised since "Invalid token or expired token" is not really relevant for api key

Additionally, it would be better to return 401 instead of 402 here. (WDYT @StanGirard ? 402 is the fabulous "Payment Required")

@StanGirard StanGirard merged commit 33f49ee into main Jun 14, 2023
3 checks passed
bO-05 pushed a commit to bO-05/quivr that referenced this pull request Jun 15, 2023
* feat: user can create api keys

* fix: linting on build

* Update backend/routes/api_key_routes.py

* chore: rename and refactor AuthBearer

* chore: add types
StanGirard pushed a commit that referenced this pull request Sep 12, 2023
* feat: user can create api keys

* fix: linting on build

* Update backend/routes/api_key_routes.py

* chore: rename and refactor AuthBearer

* chore: add types
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.

[API Key Gen] AAUser I can create an API key with the FE for Quivr
3 participants