fix(sdk): Can't assert identity without session

This commit is contained in:
Johannes Becker
2022-07-12 10:44:56 +02:00
parent 2d0653894c
commit 420ca26bf5
2 changed files with 7 additions and 3 deletions

View File

@@ -239,8 +239,11 @@ impl ClientBuilder {
/// All outgoing http requests will have a GET query key-value appended with
/// `user_id` being the key and the `user_id` from the `Session` being
/// the value. Will error if there's no `Session`. This is called
/// [identity assertion] in the Matrix Application Service Spec
/// the value. This is called [identity assertion] in the
/// Matrix Application Service Spec.
///
/// Requests that don't require authentication might not do identity
/// assertion.
///
/// [identity assertion]: https://spec.matrix.org/unstable/application-service-api/#identity-assertion
#[doc(hidden)]

View File

@@ -125,7 +125,8 @@ impl HttpClient {
}
trace!("Serializing request");
let request = if !config.assert_identity {
// We can't assert the identity without a session.
let request = if !config.assert_identity || session.is_none() {
let send_access_token = if auth_scheme == AuthScheme::None && !config.force_auth {
// Small optimization: Don't take the session lock if we know the auth token
// isn't going to be used anyways.