feat(settings): add persistent access token management - #1007
Conversation
e5c7a44 to
a3e0d6e
Compare
|
Keeping this PR in draft and on hold. Backend is split in
Once those backend PRs are reviewed/merged, I will update/rebase this frontend PR against the final backend API. |
|
Draft note: We'll align this PR once backend API shape is finalized. |
a3e0d6e to
eedeeda
Compare
|
I rebased this frontend branch on current main and aligned it with the finalized backend API from gramps-web-api#790 and #792. This completes the frontend implementation step described in gramps-web#683. |
|
Thanks for this! But since we implement the generic long-lived token infrastructure in the backend (but not the ICS subscription yet), I'd like to have a centralized place in the settings where tokens can be revoked, before we implement the ICS subcription in the backend. Would you be willing to implement this? Sorry if my comment gramps-project/gramps-web-api#792 (comment) was misleading. I think we can merge the entire feature in the next couple of weeks 🚀 |
|
I'm on it ;) |
eedeeda to
0b49a39
Compare
|
I rebuilt this PR as the centralized persistent token management UI requested. It now provides token status and confirmed revocation under Settings > User, without retrieving or storing raw token values. The previous ICS generation and subscription controls have been removed from this PR and will be submitted in a next one. |
There was a problem hiding this comment.
Pull request overview
Adds a new Settings > User > Access tokens section to manage scoped persistent access tokens (API-backed feature gated on Gramps Web API >= 3.18), allowing users to review scope status and revoke active tokens without ever handling raw token values.
Changes:
- Introduces a small frontend registry of known persistent token scopes and a UI to show per-scope status (Active/Inactive/Loading/Unavailable) with error isolation and retry.
- Adds revocation flow with confirmation dialog, scoped API calls (
GETstatus,DELETErevoke), and notifications/errors. - Adds unit tests covering version gating, status loading/error handling, revocation confirmation paths, and ensuring raw tokens / generation helpers are not exposed.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/views/GrampsjsViewSettingsUser.js |
Adds token-scope registry, status fetching, revoke dialog + handlers, and gated rendering in the User settings view. |
lang/en.json |
Adds frontend i18n strings for the new Access tokens UI. |
test/unit/settings-user-access-tokens.test.js |
Adds unit coverage for token status, retries, revocation flows, and security constraints (no raw token handling). |
|
Ah ok my bad I didn't understand correctly. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
Suppressed comments (2)
src/views/GrampsjsViewSettingsUser.js:245
- When the settings view becomes inactive (active=false) while the revocation dialog is open,
_pendingAccessTokenScopeis never cleared. This can cause the dialog to reappear unexpectedly when navigating back to the view (since rendering is gated byshouldUpdate()and the state persists). Clearing_pendingAccessTokenScopewhenactiveflips to false avoids stale dialogs across navigation.
if (this.active && changed.has('active')) {
this._loadAccessTokenStatusesIfNeeded(true)
} else if (this.active && changed.has('appState')) {
this._loadAccessTokenStatusesIfNeeded()
}
src/views/GrampsjsViewSettingsUser.js:593
- The revocation dialog only listens for
cancel, but Materialmd-dialogcan close via other paths (and other dialogs in this repo reset state via@closed, e.g. src/components/GrampsjsTagsManager.js:144-148). Adding an@closedhandler ensures_pendingAccessTokenScopeis cleared whenever the dialog closes.
<md-dialog open @cancel="${this._cancelAccessTokenRevocation}">

Summary
Add centralized persistent access token management under Settings > User > Account.
This uses the scoped persistent token infrastructure introduced in gramps-web-api#790.
What's included
GET /api/users/-/access-tokens/<scope>/DELETE /api/users/-/access-tokens/<scope>/Security
Testing
Added unit coverage for:
Related