-
I've tried to implement the authentication in my Windows App SDK app. But the auth seems always fail. I can see my client appears on the obs-websocket settings window. var secret = Helpers.Base64Encode(Helpers.ComputeSha256Hash($"{Password}{auth.salt}"));
var pass = Helpers.Base64Encode(Helpers.ComputeSha256Hash($"{secret}{auth.challenge}"));
data.authentication = pass; All the JSON are correctly deserialized. The password is correct too. And these are the helper functions: private static byte[] GetUtf8Bytes(string input)
{
return Encoding.UTF8.GetBytes(input);
}
public static string Base64Encode(string input)
{
return Convert.ToBase64String(GetUtf8Bytes(input));
}
public static string ComputeSha256Hash(string input)
{
// Create a SHA256
using SHA256 sha256Hash = SHA256.Create();
// ComputeHash - returns byte array
byte[] bytes = sha256Hash.ComputeHash(GetUtf8Bytes(input));
// Convert byte array to a input
StringBuilder builder = new();
foreach (var b in bytes)
{
builder.Append(b.ToString("x2"));
}
return builder.ToString();
} Is there any mistake I made during this progress or it's a problem rooted somewhere else? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I'm not a c# dev, but here's how obs-websocket-dotnet handles their authentication: https://github.com/BarRaider/obs-websocket-dotnet/blob/v5-dev/obs-websocket-dotnet/OBSWebsocket.cs#L548 |
Beta Was this translation helpful? Give feedback.
I'm not a c# dev, but here's how obs-websocket-dotnet handles their authentication: https://github.com/BarRaider/obs-websocket-dotnet/blob/v5-dev/obs-websocket-dotnet/OBSWebsocket.cs#L548