about summary refs log tree commit diff
path: root/MatrixRoomUtils.Core/Authentication
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-06-30 03:36:58 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2023-06-30 03:36:58 +0200
commitbb8c2637af3b7982e7a4b2fd15e2fbec613d0848 (patch)
treeb8075ba7e507aad3f96f354712ad920ac421e474 /MatrixRoomUtils.Core/Authentication
parentUpdate stuff (diff)
downloadMatrixUtils-bb8c2637af3b7982e7a4b2fd15e2fbec613d0848.tar.xz
Todays progress
Diffstat (limited to 'MatrixRoomUtils.Core/Authentication')
-rw-r--r--MatrixRoomUtils.Core/Authentication/MatrixAuth.cs35
1 files changed, 0 insertions, 35 deletions
diff --git a/MatrixRoomUtils.Core/Authentication/MatrixAuth.cs b/MatrixRoomUtils.Core/Authentication/MatrixAuth.cs
deleted file mode 100644

index 28e0c49..0000000 --- a/MatrixRoomUtils.Core/Authentication/MatrixAuth.cs +++ /dev/null
@@ -1,35 +0,0 @@ -using System.Net.Http.Json; -using System.Text.Json; -using MatrixRoomUtils.Core.Extensions; -using MatrixRoomUtils.Core.Responses; -using MatrixRoomUtils.Core.StateEventTypes; - -namespace MatrixRoomUtils.Core.Authentication; - -public class MatrixAuth { - [Obsolete("This is possibly broken and should not be used.", true)] - public static async Task<LoginResponse> Login(string homeserver, string username, string password) { - Console.WriteLine($"Logging in to {homeserver} as {username}..."); - homeserver = (new RemoteHomeServer(homeserver)).FullHomeServerDomain; - var hc = new MatrixHttpClient(); - var payload = new { - type = "m.login.password", - identifier = new { - type = "m.id.user", - user = username - }, - password, - initial_device_display_name = "Rory&::MatrixRoomUtils" - }; - Console.WriteLine($"Sending login request to {homeserver}..."); - var resp = await hc.PostAsJsonAsync($"{homeserver}/_matrix/client/v3/login", payload); - Console.WriteLine($"Login: {resp.StatusCode}"); - var data = await resp.Content.ReadFromJsonAsync<JsonElement>(); - if (!resp.IsSuccessStatusCode) Console.WriteLine("Login: " + data); - - Console.WriteLine($"Login: {data.ToJson()}"); - return data.Deserialize<LoginResponse>(); - //var token = data.GetProperty("access_token").GetString(); - //return token; - } -} \ No newline at end of file