about summary refs log tree commit diff
path: root/MatrixRoomUtils.Core/Authentication/MatrixAuth.cs
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-06-26 02:43:54 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2023-06-27 17:43:00 +0200
commit3ed00f732a284b5a3e96e52d4e3a71869135869b (patch)
tree308cdd5c9891a676dc55cbf0e0e998ab5a74b2d2 /MatrixRoomUtils.Core/Authentication/MatrixAuth.cs
parentWorking state, refactored Rory&::LibMatrix (diff)
downloadMatrixUtils-3ed00f732a284b5a3e96e52d4e3a71869135869b.tar.xz
Dependency injection stuff
Diffstat (limited to 'MatrixRoomUtils.Core/Authentication/MatrixAuth.cs')
-rw-r--r--MatrixRoomUtils.Core/Authentication/MatrixAuth.cs7
1 files changed, 1 insertions, 6 deletions
diff --git a/MatrixRoomUtils.Core/Authentication/MatrixAuth.cs b/MatrixRoomUtils.Core/Authentication/MatrixAuth.cs

index 83b279a..b1b0362 100644 --- a/MatrixRoomUtils.Core/Authentication/MatrixAuth.cs +++ b/MatrixRoomUtils.Core/Authentication/MatrixAuth.cs
@@ -10,7 +10,7 @@ public class MatrixAuth { public static async Task<LoginResponse> Login(string homeserver, string username, string password) { Console.WriteLine($"Logging in to {homeserver} as {username}..."); homeserver = (await new RemoteHomeServer(homeserver).Configure()).FullHomeServerDomain; - var hc = new HttpClient(); + var hc = new MatrixHttpClient(); var payload = new { type = "m.login.password", identifier = new { @@ -25,11 +25,6 @@ public class MatrixAuth { Console.WriteLine($"Login: {resp.StatusCode}"); var data = await resp.Content.ReadFromJsonAsync<JsonElement>(); if (!resp.IsSuccessStatusCode) Console.WriteLine("Login: " + data); - if (data.TryGetProperty("retry_after_ms", out var retryAfter)) { - Console.WriteLine($"Login: Waiting {retryAfter.GetInt32()}ms before retrying"); - await Task.Delay(retryAfter.GetInt32()); - return await Login(homeserver, username, password); - } Console.WriteLine($"Login: {data.ToJson()}"); return data.Deserialize<LoginResponse>();