Skip to content

Commit c97513f

Browse files
xuyushun441-sysos-zhuangclaude
authored
fix(console): DeviceAuthPage keeps device context through the login redirect (#1674)
The signed-out branch rebuilt the redirect from user_code alone, dropping runtime_name/runtime_version — a signed-out approver never saw what device they were authorizing (found in the bind-v2 E2E). Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent 77cc6bb commit c97513f

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@object-ui/console": patch
3+
---
4+
5+
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.

apps/console/src/pages/auth/DeviceAuthPage.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*/
99

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

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

9495
if (!user) {
96+
// Preserve the FULL query string through the login round-trip — it
97+
// carries the device context (runtime_name / runtime_version) the
98+
// approval card displays, not just the user code.
9599
return (
96100
<Navigate
97-
to={`/login?redirect=${encodeURIComponent(
98-
`/auth/device?user_code=${encodeURIComponent(code)}`,
99-
)}`}
101+
to={`/login?redirect=${encodeURIComponent(`/auth/device${location.search}`)}`}
100102
replace
101103
/>
102104
);

0 commit comments

Comments
 (0)