Conversation
## Because - `fxaccounts:oauth_flow_begin` carries no service in either direction. FxA rebuilds the sign-in URL and hardcodes `service=sync`. - Every caller today is a Sync flow, so that literal is correct. A future FxA-initiated non-Sync flow would become a Sync sign-in with no error. - This is hardening, not a bug fix. No current caller changes behaviour. ## This pull request - Adds an optional `service` argument to `fxaOAuthFlowBegin`. The payload sends it with the scopes, and omits the key when the caller passes none. - Renames `buildSyncOAuthSearch` to `buildOAuthSearch`. It takes the service from the caller, then the browser echo, then falls back to `sync`. - Adds `WebChannelService`, derived from the `WebChannelServices` keys. A runtime set rejects an echo that is not one of the four names. - Passes `sync` explicitly from `Pair/Index` and `ConnectAnotherDevice`, and adds a CAD test that asserts the resulting URL. - Leaves `useOAuthFlowRecovery` alone. It still preserves the params already in the URL. ## Issue that this pull request solves Closes: https://mozilla-hub.atlassian.net/browse/FXA-14371
Contributor
There was a problem hiding this comment.
Pull request overview
Threads OAuth service identity through Firefox WebChannel flow startup while preserving Sync defaults and validating browser echoes.
Changes:
- Adds typed service payloads and validated precedence handling.
- Updates Pair and Connect Another Device to pass
sync. - Expands unit and navigation coverage.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
pages/Pair/Index/index.tsx |
Passes Sync service through pairing bootstrap. |
pages/Pair/Index/index.test.tsx |
Verifies the service argument. |
pages/ConnectAnotherDevice/index.tsx |
Preserves Sync service during sign-in. |
pages/ConnectAnotherDevice/index.test.tsx |
Tests the generated Sync URL. |
lib/channels/firefox.ts |
Adds service typing, validation, and WebChannel payload support. |
lib/channels/firefox.test.ts |
Tests service precedence, validation, and payload omission. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Because
fxaccounts:oauth_flow_begincarries no service in either direction. FxA rebuilds the sign-in URL and hardcodesservice=sync.This pull request
serviceargument tofxaOAuthFlowBegin. The payload sends it with the scopes, and omits the key when the caller passes none.buildSyncOAuthSearchtobuildOAuthSearch. It takes the service from the caller, then the browser echo, then falls back tosync.WebChannelService, derived from theWebChannelServiceskeys. A runtime set rejects an echo that is not one of the four names.syncexplicitly fromPair/IndexandConnectAnotherDevice, and adds a CAD test that asserts the resulting URL.useOAuthFlowRecoveryalone. It still preserves the params already in the URL.Issue that this pull request solves
Closes: https://mozilla-hub.atlassian.net/browse/FXA-14371
Checklist
Put an
xin the boxes that applyHow to review (Optional)
firefox.ts. Look at the precedence chain inbuildOAuthSearchand the payload infxaOAuthFlowBegin.firefox.ts, thenfirefox.test.ts, then the two call sites.service=syncwhatever the browser sends.Screenshots (Optional)
No user interface change.
Other information (Optional)
packages/fxa-settingsunit tests: 3305 passed, 0 failed.nx lint fxa-settings: 0 errors.models/integrations/oauth-native-integration.tsforgetWebChannelServices. It is declared inmodels/integrations/integration.tsand overridden inoauth-native-integration.ts.packages/functional-tests/lib/channels.tsneeded no edit. It already types the mocked browser response asFxAOAuthFlowBeginResponse, so the new field flows through.