Skip to content

feat(auth): Allow device management for Firefox client_ids#20644

Merged
LZoog merged 1 commit into
mainfrom
FXA-13704
May 28, 2026
Merged

feat(auth): Allow device management for Firefox client_ids#20644
LZoog merged 1 commit into
mainfrom
FXA-13704

Conversation

@LZoog
Copy link
Copy Markdown
Contributor

@LZoog LZoog commented May 26, 2026

Because:

  • Currently, the only OAuth scope allowed to register/manage a device via refresh token is the Sync scope and other scopes are explicitly rejected by the refreshToken auth scheme's scope allowlist. When Firefox logins occur without Sync but with a refresh token, we still want the device registered.

This commit:

  • Changes the gate for device management from a refresh token with the Sync scope, to a refresh token tied to a Firefox client ID

closes FXA-13704

Copilot AI review requested due to automatic review settings May 26, 2026 16:29
@LZoog LZoog requested a review from a team as a code owner May 26, 2026 16:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the refreshToken auth scheme used for the Devices API so that device registration/management is allowed based on an allowlist of Firefox OAuth client_ids, rather than requiring the legacy oldsync scope. This supports Firefox sign-ins that obtain refresh tokens without Sync scope, while still permitting device registration.

Changes:

  • Replace the refresh-token scheme gate from “must include oldsync scope” to “must be an allowlisted Firefox client_id”.
  • Add config for oauth.deviceRegistrationClientIds (with default Firefox client IDs) to control which clients may use refresh tokens for device operations.
  • Add/adjust unit + integration tests to cover allowlisted client behavior with non-Sync scopes.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
packages/fxa-auth-server/test/remote/device_tests_refresh_tokens.in.spec.ts Adds an integration test ensuring device registration works with a Firefox client_id refresh token that lacks oldsync scope.
packages/fxa-auth-server/lib/routes/auth-schemes/refresh-token.spec.ts Updates auth-scheme tests to validate allowlisted vs non-allowlisted client_id behavior and allow non-Sync scopes for allowlisted clients.
packages/fxa-auth-server/lib/routes/auth-schemes/refresh-token.js Implements the client_id allowlist gate for refresh-token authentication to device endpoints.
packages/fxa-auth-server/config/index.ts Introduces oauth.deviceRegistrationClientIds convict config with defaults for Firefox clients.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/fxa-auth-server/lib/routes/auth-schemes/refresh-token.js Outdated
Copy link
Copy Markdown
Contributor

@vbudhram vbudhram left a comment

Choose a reason for hiding this comment

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

@LZoog Just the question about device management vs register. Might be good to confirm because this will allow clients to send commands to any device.

default: ['5882386c6d801776', '1b1a3e44c54fbb58'],
env: 'OAUTH_OLD_SYNC_CLIENT_IDS',
},
deviceRegistrationClientIds: {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just noting here that this is similar to the converstation, what belongs in database vs config. Since its a client capability, makes sense to be added to the clients table long term. Might be useful to add to our database cleanup epic.

default: ['5882386c6d801776', '1b1a3e44c54fbb58'],
env: 'OAUTH_OLD_SYNC_CLIENT_IDS',
},
deviceRegistrationClientIds: {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The name here is misleading. This allows clients to manage devices, including register, send commands, revoke etc. If we only intend to do the registration it might be better to have this check in the registration route.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thank you for calling this out, really appreciate it. After looking into it and DM'ing you/Mark it sounds like this is what we want but I'll update the config name at least and file an issue to pull this into admin panel.

Because:
* Currently, the only OAuth scope allowed to register/manage a device via refresh token is the Sync scope and other scopes are explicitly rejected by the refreshToken auth scheme's scope allowlist. When Firefox logins occur without Sync but with a refresh token, we still want the device registered.

This commit:
* Changes the gate for device management from a refresh token with the Sync scope, to a refresh token tied to a Firefox client ID

closes FXA-13704
@LZoog LZoog changed the title feat(auth): Allow device registration for Firefox client_ids feat(auth): Allow device management for Firefox client_ids May 28, 2026
Copy link
Copy Markdown
Contributor

@vbudhram vbudhram left a comment

Choose a reason for hiding this comment

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

Discussed that this was good to land 👍🏽

@LZoog LZoog merged commit 317afbc into main May 28, 2026
20 checks passed
@LZoog LZoog deleted the FXA-13704 branch May 28, 2026 20:47
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.

3 participants