Skip to content

Commit 62c3814

Browse files
authored
Merge pull request #313 from spoo-me/fix/device-login-next-redirect
fix(auth): send logged-out device-auth users to /login instead of the landing root
2 parents 744c8c6 + 7832181 commit 62c3814

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

routes/auth/device.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ async def device_login(
131131
if redirect_uri:
132132
params["redirect_uri"] = redirect_uri
133133
next_url = f"/auth/device/login?{urlencode(params)}"
134-
return RedirectResponse(f"/?next={quote(next_url)}", status_code=302)
134+
# /login is the only frontend surface that resumes ?next= after auth.
135+
return RedirectResponse(f"/login?next={quote(next_url)}", status_code=302)
135136

136137
# Check for existing active grant (auto-approve)
137138
grant = await grant_repo.find_active_grant(user.user_id, app_id)

tests/integration/test_device_auth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ def test_device_login_unauthenticated_redirects(
290290
)
291291
assert resp.status_code == 302
292292
loc = resp.headers["location"]
293-
assert "/?next=" in loc
293+
assert loc.startswith("/login?next=")
294294
assert "spoo-snap" in loc
295295
assert "abc" in loc
296296
# The PKCE challenge must survive the login round-trip

0 commit comments

Comments
 (0)