(fix): session id stuff

This commit is contained in:
Alois 2026-07-05 01:14:21 +02:00
commit cd63882b9d
3 changed files with 24 additions and 7 deletions

View file

@ -64,10 +64,14 @@ let client = TAuthClient::new(
## Start Login
Redirect the user to `client.auth_url(None)` from your web handler.
Redirect the user to `client.auth_url(None, session_id)` from your web handler. The `session_id` is a `u64` you generate (e.g. from the current time in milliseconds) — it is passed through the TAuth flow and returned in the callback so you can correlate the login with a pending session.
```rust
let login_url = client.auth_url(None);
let session_id = std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.map(|d| d.as_millis() as u64)
.unwrap_or(0);
let login_url = client.auth_url(None, session_id);
```
The URL includes:
@ -75,6 +79,7 @@ The URL includes:
- `identifier`: your app identifier
- `redirect`: your callback URL
- `public_key`: your app MTP public key bundle
- `sessionId`: the session ID you generated, passed through to the callback
- `challenge`: optional caller-supplied challenge
## Handle Callback