Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleg Koloskov committed Nov 27, 2022
1 parent 0a47ba2 commit c22ecad
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Elib2Ebook/Logic/Getters/Litnet/LitnetGetterBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,14 @@ public override async Task Authorize() {
var path = Config.HasCredentials ? "user/find-by-login" : "registration/registration-by-device";

var url = _apiUrl.MakeRelativeUri($"v1/{path}?login={HttpUtility.UrlEncode(Config.Options.Login?.TrimStart('+') ?? string.Empty)}&password={HttpUtility.UrlEncode(Config.Options.Password)}&app=android&device_id={DeviceId}&sign={GetSign(string.Empty)}");
var response = await Config.Client.GetFromJsonAsync<LitnetAuthResponse>(url);
var response = await Config.Client.GetAsync(url);
var data = await response.Content.ReadFromJsonAsync<LitnetAuthResponse>();

if (!string.IsNullOrWhiteSpace(response?.Token)) {
if (!string.IsNullOrWhiteSpace(data?.Token)) {
Console.WriteLine("Успешно авторизовались");
_token = response.Token;
_token = data.Token;
} else {
throw new Exception($"Не удалось авторизоваться. {response?.Error}");
throw new Exception($"Не удалось авторизоваться. {data?.Error}");
}
}

Expand Down

0 comments on commit c22ecad

Please sign in to comment.