This commit is contained in:
@@ -136,19 +136,47 @@ namespace Sockeye.Biz
|
||||
|
||||
try
|
||||
{
|
||||
//var content = new StringContent("login=john&password=b43698c255365ee739c05ba0d42855e96c2365c76bb2f9b9eb149cec7b52174c");
|
||||
var content = new StringContent(JsonConvert.SerializeObject(new
|
||||
{
|
||||
login = "john",
|
||||
password = "b43698c255365ee739c05ba0d42855e96c2365c76bb2f9b9eb149cec7b52174c"
|
||||
}), Encoding.UTF8, "application/json");
|
||||
|
||||
// var content = new StringContent("login=john&password=b43698c255365ee739c05ba0d42855e96c2365c76bb2f9b9eb149cec7b52174c", Encoding.UTF8, "application/json");
|
||||
|
||||
|
||||
var client = ServiceProviderProvider.HttpClientFactory.CreateClient();
|
||||
var res = await client.PostAsync($"{URL_ROCKFISH}/authenticate", content);
|
||||
var res = await client.PostAsync($"{URL_ROCKFISH}authenticate?login=john&password=b43698c255365ee739c05ba0d42855e96c2365c76bb2f9b9eb149cec7b52174c", content);
|
||||
var responseText = await res.Content.ReadAsStringAsync();
|
||||
|
||||
if (res.IsSuccessStatusCode)
|
||||
{
|
||||
log.LogInformation(responseText);
|
||||
}
|
||||
else log.LogError($"E1020 - Error authenticating to rockfish: {res.ReasonPhrase}");
|
||||
|
||||
var responseJson = JObject.Parse(responseText);
|
||||
|
||||
var authToken = responseJson["token"].Value<string>();
|
||||
var dlKey = responseJson["dlkey"].Value<string>();
|
||||
var userId = responseJson["id"].Value<long>();
|
||||
// var keyText = responseJson["data"]["key"].Value<string>();
|
||||
|
||||
// {{
|
||||
// "ok": 1,
|
||||
// "issued": 1672162767,
|
||||
// "expires": 1674754767,
|
||||
// "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOiIxNjcyMTYyNzY3IiwiZXhwIjoiMTY3NDc1NDc2NyIsImlzcyI6InJvY2tmaXNoQ29yZSIsImlkIjoiMiJ9.59Boie4EYtuRkccpf9QG8oszitx8UkGwAozgU1Effjk",
|
||||
// "dlkey": "Cz48oUgPfEitcJ3/Dxw",
|
||||
// "name": "John Cardinal",
|
||||
// "id": 2
|
||||
// }}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user