diff --git a/Pal.Client/RemoteApi.cs b/Pal.Client/RemoteApi.cs index 091d392..e12918c 100644 --- a/Pal.Client/RemoteApi.cs +++ b/Pal.Client/RemoteApi.cs @@ -17,13 +17,13 @@ namespace Pal.Client #if DEBUG private const string remoteUrl = "http://localhost:5145"; #else - private const string remoteUrl = "https://pal.μ.tv:47701"; + private const string remoteUrl = "https://pal.μ.tv"; #endif private GrpcChannel _channel; private string _authToken; private DateTime _tokenExpiresAt; - private async Task Connect(CancellationToken cancellationToken) + private async Task Connect(CancellationToken cancellationToken, bool retry = true) { if (Service.Configuration.Mode != Configuration.EMode.Online) return false; @@ -75,6 +75,24 @@ namespace Pal.Client _authToken = loginReply.AuthToken; _tokenExpiresAt = loginReply.ExpiresAt.ToDateTime().ToLocalTime(); } + else + { + _authToken = null; + if (loginReply.Error == LoginError.InvalidAccountId) + { + accountId = null; +#if DEBUG + Service.Configuration.DebugAccountId = accountId; +#else + Service.Configuration.AccountId = accountId; +#endif + Service.Configuration.Save(); + if (retry) + return await Connect(cancellationToken, retry: false); + else + return false; + } + } } return !string.IsNullOrEmpty(_authToken);