Skip to main content

## adopt_session

# Function adopt_session

Source

    async fn adopt_session(
        db: State<'_, DatabaseWrapper>,
        creds: State<'_, CredentialStoreWrapper>,
        auth_manager: &State<'_, AuthManagerWrapper>,
    ) -> Result<(), String>

Expand description

Make the newly-active profile the session the rest of the backend acts as.

The token lives in the credential store, which the frontend cannot read, so the swap has to happen here — the frontend then rebuilds its repository handle from the session it can now read back. This mirrors what `auth_initialize` does on a cold start, and deliberately reuses the same storage path rather than a second one that could drift from it.

TRACES: UR-082 | DR-270