Skip to main content

callback_page/
callback-page.rs

1//! Render the real callback page with fictional data, without signing in.
2//! `cargo run -p subspace-github-auth --example callback-page -- success > /tmp/success.html`
3
4use subspace_core::Secret;
5use subspace_github_auth::AuthError;
6use subspace_github_auth::browser::{Callback, page};
7
8fn fixture(state: Option<&str>) -> Callback {
9    match state {
10        Some("error") => Callback::Failed(AuthError::StateMismatch),
11        Some("not-found") => Callback::Other,
12        _ => Callback::Code(Secret::new("fixture-code")),
13    }
14}
15
16fn main() {
17    let callback = fixture(std::env::args().nth(1).as_deref());
18    print!("{}", page(&callback).1);
19}