feat: allow users to mint authentication tokens from the ui, and communities to revert them#3614
Open
tefkah wants to merge 1 commit into
Open
feat: allow users to mint authentication tokens from the ui, and communities to revert them#3614tefkah wants to merge 1 commit into
tefkah wants to merge 1 commit into
Conversation
…unities to revert them
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds UI and API support for minting, listing, and revoking community-scoped authentication tokens from user account settings and community admin settings.
Changes:
- Adds auth token list/revoke endpoints for users and community admins.
- Adds user settings UI for generating and revoking personal auth tokens.
- Adds community settings UI for admins to view and revoke community-scoped tokens.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
utils/api/contracts/authToken.ts |
Extends the auth token contract with listing and community revoke routes. |
server/routes/legal.tsx |
Passes admin community data into legal/settings view data. |
server/community/queries.ts |
Adds a query for communities where the user is an admin. |
server/authToken/api.ts |
Implements token listing and community-level revocation endpoints. |
server/authToken/__tests__/api.test.ts |
Adds tests for listing and revoking auth tokens. |
client/containers/Legal/PrivacySettings.tsx |
Renders the auth token settings card. |
client/containers/Legal/Legal.tsx |
Adds admin community props for settings. |
client/containers/Legal/AuthTokensCard.tsx |
Adds user-facing auth token creation/list/revoke UI. |
client/containers/DashboardSettings/CommunitySettings/CommunityAuthTokens.tsx |
Adds community admin token list/revoke UI. |
client/containers/DashboardSettings/CommunitySettings/CommunityAdminSettings.tsx |
Adds the community auth token section to admin settings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+74
to
+77
| await ensureUserIsCommunityAdmin({ | ||
| user: req.user, | ||
| id: params.communityId, | ||
| }); |
Comment on lines
+122
to
+125
| await ensureUserIsCommunityAdmin({ | ||
| user: req.user, | ||
| id: params.communityId, | ||
| }); |
| .delete(`/api/authTokens/community/${anotherCommunity.id}/${anotherAuthToken.id}`) | ||
| .set('Host', `${community.subdomain}.pubpub.org`) | ||
| .expect(403); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue(s) Resolved
We will be changing log in mechanisms soon, which may break sdk/api usage. we should enable the ability to mint auth tokens from the ui
Tokens are scoped to community + user.
Tokens cna be revoked by the user or any admin of the community.
Test Plan
Screenshots (if applicable)
User view
Community view

Optional
Notes/Context/Gotchas
Supporting Docs