Skip to main content

create_session_cookie

Function create_session_cookie 

Source
pub async fn create_session_cookie(
    http: &HttpClient,
    endpoint: &str,
    id_token: &str,
    valid_duration: Duration,
    bearer_token: Option<&str>,
    emulator_api_key: Option<&str>,
) -> Result<String, AuthError>
Expand description

Exchanges a verified ID token for a long-lived session cookie.

endpoint is the fully-qualified :createSessionCookie URL, which differs between live and emulator crate::auth::mode::ClientMode. bearer_token must be Some in live mode (this endpoint, like the rest of the Identity Toolkit API, requires OAuth2 authentication there) and is ignored in emulator mode, where emulator_api_key must be Some instead — see crate::auth::mode::ClientMode::emulator_api_key.