From 5f761d4fe8d418b04f31c9670c7c118961cd686e Mon Sep 17 00:00:00 2001 From: FrigaT Date: Mon, 20 Apr 2026 15:56:38 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=B0=D0=B2=D1=82=D0=BE=D1=80=D0=B8=D0=B7=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D1=8F=20=D1=87=D0=B5=D1=80=D0=B5=D0=B7=20=D0=BF?= =?UTF-8?q?=D0=B0=D1=81=D0=BF=D0=BE=D1=80=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YandexMusic.API/API/YUserAPI.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/YandexMusic.API/API/YUserAPI.cs b/YandexMusic.API/API/YUserAPI.cs index 960b864..dd78fa3 100644 --- a/YandexMusic.API/API/YUserAPI.cs +++ b/YandexMusic.API/API/YUserAPI.cs @@ -45,7 +45,7 @@ public class YUserAPI : YCommonAPI Api.Storage.AccessToken = accessToken; Api.Storage.Token = accessToken.AccessToken; - await AuthorizeAsync(accessToken.AccessToken); + await AuthorizeByPassportAsync(accessToken.AccessToken); return true; } @@ -63,6 +63,16 @@ public class YUserAPI : YCommonAPI Api.Storage.SetAuthorized(authInfo.Account, token); } + public async Task AuthorizeByPassportAsync(string token) + { + if (string.IsNullOrEmpty(token)) + throw new Exception("Токен не может быть пустым"); + + Api.Storage.Token = token; + await GetAccessTokenAsync(); + await AuthorizeAsync(Api.Storage.Token); + } + public Task GetUserAuthAsync() => new YGetAuthInfoBuilder(Api).ExecuteAsync(null!);