-
Notifications
You must be signed in to change notification settings - Fork 92
feat(accounts): add refreshable browser OAuth link #316
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
Open
mhughdo
wants to merge
4
commits into
Soju06:main
Choose a base branch
from
mhughdo:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| ## Why | ||
| The Accounts page OAuth dialog currently generates a browser PKCE authorization link only when the user first clicks `Start sign-in`. Because the link is single-use, operators who want to sign in multiple accounts in sequence must leave the current browser step and start over to mint another link. That adds unnecessary friction to a common dashboard workflow. | ||
|
|
||
| ## What Changes | ||
| - Add an explicit refresh action to the browser PKCE stage of the Accounts OAuth dialog. | ||
| - Reuse the existing browser OAuth start flow so refreshing creates a fresh authorization URL without forcing the user to leave the dialog. | ||
| - Cover the refreshed-link behavior with frontend tests. | ||
|
|
||
| ## Impact | ||
| - Affects the Accounts page OAuth dialog in the frontend. | ||
| - Reuses the existing `/api/oauth/start` browser flow and its PKCE/state regeneration. | ||
| - No API contract changes are required. |
40 changes: 40 additions & 0 deletions
40
openspec/changes/refresh-browser-oauth-link/specs/frontend-architecture/spec.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| ## MODIFIED Requirements | ||
|
|
||
| ### Requirement: Accounts page | ||
|
|
||
| The Accounts page SHALL display a two-column layout: left panel with searchable account list, import button, and add account button; right panel with selected account details including usage, token info, and actions (pause/resume/delete/re-authenticate). | ||
|
|
||
| #### Scenario: Account selection | ||
|
|
||
| - **WHEN** a user clicks an account in the list | ||
| - **THEN** the right panel shows the selected account's details | ||
|
|
||
| #### Scenario: Account import | ||
|
|
||
| - **WHEN** a user clicks the import button and uploads an auth.json file | ||
| - **THEN** the app calls `POST /api/accounts/import` and refreshes the account list on success | ||
|
|
||
| #### Scenario: Ambiguous duplicate identity import conflict | ||
|
|
||
| - **WHEN** `importWithoutOverwrite` was previously enabled and duplicate accounts with the same email exist | ||
| - **AND** overwrite mode is enabled again | ||
| - **AND** a new import matches multiple existing accounts by email without an exact ID match | ||
| - **THEN** `POST /api/accounts/import` returns `409` with `error.code=duplicate_identity_conflict` | ||
| - **AND** no existing account is modified | ||
|
|
||
| #### Scenario: OAuth add account | ||
|
|
||
| - **WHEN** a user clicks the add account button | ||
| - **THEN** an OAuth dialog opens with browser and device code flow options | ||
|
|
||
| #### Scenario: Browser OAuth link refresh | ||
|
|
||
| - **WHEN** a user is on the browser PKCE step of the OAuth dialog | ||
| - **AND** the current authorization URL has already been used or needs to be replaced | ||
| - **THEN** the dialog offers a refresh action that starts the browser OAuth flow again without leaving the dialog | ||
| - **AND** the dialog updates to the newly generated authorization URL | ||
|
|
||
| #### Scenario: Account actions | ||
|
|
||
| - **WHEN** a user clicks pause/resume/delete on an account | ||
| - **THEN** the corresponding API is called and the account list is refreshed |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.