allow plex re-authentication
This commit is contained in:
@@ -8,6 +8,7 @@ using ErsatzTV.Core.Interfaces.Plex;
|
||||
using ErsatzTV.Core.Plex;
|
||||
using ErsatzTV.Infrastructure.Plex.Models;
|
||||
using LanguageExt;
|
||||
using Refit;
|
||||
|
||||
namespace ErsatzTV.Infrastructure.Plex
|
||||
{
|
||||
@@ -20,9 +21,7 @@ namespace ErsatzTV.Infrastructure.Plex
|
||||
|
||||
public PlexTvApiClient(IPlexTvApi plexTvApi, IPlexSecretStore plexSecretStore)
|
||||
{
|
||||
// var client = new HttpClient(new HttpLoggingHandler()) { BaseAddress = new Uri("https://plex.tv/api/v2") };
|
||||
|
||||
_plexTvApi = plexTvApi; // RestService.For<IPlexTvApi>(client);
|
||||
_plexTvApi = plexTvApi;
|
||||
_plexSecretStore = plexSecretStore;
|
||||
}
|
||||
|
||||
@@ -80,6 +79,15 @@ namespace ErsatzTV.Infrastructure.Plex
|
||||
|
||||
return result;
|
||||
}
|
||||
catch (ApiException apiException)
|
||||
{
|
||||
if (apiException.ReasonPhrase == "Unauthorized")
|
||||
{
|
||||
await _plexSecretStore.DeleteAll();
|
||||
}
|
||||
|
||||
return BaseError.New(apiException.Message);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BaseError.New(ex.Message);
|
||||
|
||||
Reference in New Issue
Block a user