Sign-in ends on a page with a button back to the editor

Browsers open an app link only after a click on the page. With a live
identity provider session the whole sign-in ran without one, so the
redirect to vscode:// was dropped and the editor never got its code. The
page opens the editor at once and keeps a button for when that is held
back. Server 0.1.4, chart 0.1.5.
This commit is contained in:
Oleg Lukasonok committed 2026-11-08 19:56:53 +02:00
1 parent 50d3d81b78
commit 253635ffef
4 files changed
+18 -7

No files matched your search

+12 -1
View File
@@ -314,7 +314,18 @@ async fn complete(state: &AppState, q: &AuthorizeQuery, account: &AccountRow) ->
.query_pairs_mut()
.append_pair("code", &code)
.append_pair("state", &q.state);
Redirect::to(target.as_str()).into_response()
// A page, not a redirect: browsers open an app link only after a click on
// the page, and with a live identity provider session nobody clicked. The
// page tries at once and keeps a button for when the browser held back.
let link = escape(target.as_str());
page(
state,
"Signed in",
&format!(
r#"<meta http-equiv="refresh" content="0;url={link}"><div class="card"><h2>Signed in as {}</h2><p class="muted">Your editor finishes the sign-in. If it did not open, use the button.</p><a class="button" href="{link}">Open the editor</a></div>"#,
escape(&account.display_name),
),
)
}
async fn sign_in(state: &AppState, form: &AuthorizeForm) -> Result<AccountRow, ApiErr> {