-
-
Notifications
You must be signed in to change notification settings - Fork 599
Add device authorization flow for TV-app-style pairing (RFC 8628) #3308
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
Merged
gantoine
merged 6 commits into
rommapp:master
from
tmgast:feature/device-flow-authorization
Jun 21, 2026
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
519abc1
Add device authorization flow for TV-app-style pairing (RFC 8628)
tmgast 812491f
Refine device authorization flow
tmgast 77970f6
Merge branch 'master' into feature/device-flow-authorization
gantoine 765d2a2
fix settings.json
gantoine 3890259
changes from bot review
gantoine 1f98b2d
run fmt
gantoine 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
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
backend/alembic/versions/0084_devices_client_device_identifier.py
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,36 @@ | ||
| """Add client_device_identifier to devices | ||
|
|
||
| Revision ID: 0084_devices_client_identifier | ||
| Revises: 0083_rom_category_soundtrack | ||
| Create Date: 2026-04-24 00:00:00.000000 | ||
|
|
||
| """ | ||
|
|
||
| import sqlalchemy as sa | ||
| from alembic import op | ||
|
|
||
| # revision identifiers, used by Alembic. | ||
| revision = "0084_devices_client_identifier" | ||
| down_revision = "0083_rom_category_soundtrack" | ||
| branch_labels = None | ||
| depends_on = None | ||
|
|
||
|
|
||
| def upgrade() -> None: | ||
| with op.batch_alter_table("devices", schema=None) as batch_op: | ||
| batch_op.add_column( | ||
| sa.Column("client_device_identifier", sa.String(length=255), nullable=True), | ||
| if_not_exists=True, | ||
| ) | ||
| batch_op.create_index( | ||
| "ix_devices_user_client_identifier", | ||
| ["user_id", "client_device_identifier"], | ||
| unique=True, | ||
| if_not_exists=True, | ||
| ) | ||
|
|
||
|
|
||
| def downgrade() -> None: | ||
| with op.batch_alter_table("devices", schema=None) as batch_op: | ||
| batch_op.drop_index("ix_devices_user_client_identifier", if_exists=True) | ||
| batch_op.drop_column("client_device_identifier", if_exists=True) | ||
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,45 @@ | ||
| """Add device_id FK to client_tokens | ||
|
|
||
| Revision ID: 0085_client_tokens_device_id | ||
| Revises: 0084_devices_client_identifier | ||
| Create Date: 2026-04-24 00:00:00.000000 | ||
|
|
||
| """ | ||
|
|
||
| import sqlalchemy as sa | ||
| from alembic import op | ||
|
|
||
| # revision identifiers, used by Alembic. | ||
| revision = "0085_client_tokens_device_id" | ||
| down_revision = "0084_devices_client_identifier" | ||
| branch_labels = None | ||
| depends_on = None | ||
|
|
||
|
|
||
| def upgrade() -> None: | ||
| with op.batch_alter_table("client_tokens", schema=None) as batch_op: | ||
| batch_op.add_column( | ||
| sa.Column("device_id", sa.String(length=255), nullable=True), | ||
| if_not_exists=True, | ||
| ) | ||
| batch_op.create_foreign_key( | ||
| "fk_client_tokens_device_id", | ||
| "devices", | ||
| ["device_id"], | ||
| ["id"], | ||
| ondelete="SET NULL", | ||
| ) | ||
| batch_op.create_index( | ||
| "ix_client_tokens_device_id", | ||
| ["device_id"], | ||
| unique=False, | ||
| if_not_exists=True, | ||
| ) | ||
|
|
||
|
|
||
| def downgrade() -> None: | ||
| with op.batch_alter_table("client_tokens", schema=None) as batch_op: | ||
| # Drop FK before the backing index -- MariaDB refuses otherwise | ||
| batch_op.drop_constraint("fk_client_tokens_device_id", type_="foreignkey") | ||
| batch_op.drop_index("ix_client_tokens_device_id", if_exists=True) | ||
| batch_op.drop_column("device_id", if_exists=True) |
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,37 @@ | ||
| # Local test infrastructure matching .github/workflows/pytest.yml. | ||
| # Usage: docker compose -f docker-compose.test.yml up -d | ||
| # uv run pytest | ||
| services: | ||
| mariadb: | ||
| image: mariadb:10.11 | ||
| ports: | ||
| - "3306:3306" | ||
| environment: | ||
| MYSQL_USER: romm_test | ||
| MYSQL_PASSWORD: passwd | ||
| MYSQL_DATABASE: romm_test | ||
| MYSQL_ROOT_PASSWORD: passwd | ||
| healthcheck: | ||
| test: | ||
| [ | ||
| "CMD", | ||
| "mariadb-admin", | ||
| "ping", | ||
| "-h", | ||
| "127.0.0.1", | ||
| "-uroot", | ||
| "-ppasswd", | ||
| ] | ||
| interval: 5s | ||
| timeout: 2s | ||
| retries: 10 | ||
|
|
||
| valkey: | ||
| image: valkey/valkey:7.2 | ||
| ports: | ||
| - "6379:6379" | ||
| healthcheck: | ||
| test: ["CMD", "redis-cli", "ping"] | ||
| interval: 5s | ||
| timeout: 2s | ||
| retries: 10 |
Oops, something went wrong.
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.