Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/device-redirect-context.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@object-ui/console": patch
---

DeviceAuthPage preserves the full query string (runtime_name / runtime_version device context) through the login redirect — previously only user_code survived, so a signed-out approver never saw what device they were authorizing.
10 changes: 6 additions & 4 deletions apps/console/src/pages/auth/DeviceAuthPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

import { useState } from 'react';
import { Navigate, useNavigate, useSearchParams } from 'react-router-dom';
import { Navigate, useLocation, useNavigate, useSearchParams } from 'react-router-dom';
import { CheckCircle2, GalleryVerticalEnd } from 'lucide-react';
import { toast } from 'sonner';
import { useAuth } from '@object-ui/auth';
Expand Down Expand Up @@ -42,6 +42,7 @@ function PageShell({ children }: { children: React.ReactNode }) {

export function DeviceAuthPage() {
const { t } = useObjectTranslation();
const location = useLocation();
const [params] = useSearchParams();
const code = params.get('user_code') ?? params.get('code') ?? '';
// Device context appended by the requesting runtime's bind/start (ADR
Expand Down Expand Up @@ -92,11 +93,12 @@ export function DeviceAuthPage() {
}

if (!user) {
// Preserve the FULL query string through the login round-trip — it
// carries the device context (runtime_name / runtime_version) the
// approval card displays, not just the user code.
return (
<Navigate
to={`/login?redirect=${encodeURIComponent(
`/auth/device?user_code=${encodeURIComponent(code)}`,
)}`}
to={`/login?redirect=${encodeURIComponent(`/auth/device${location.search}`)}`}
replace
/>
);
Expand Down
Loading