|
|
@ -1509,14 +1509,20 @@ namespace Emby.Server.Implementations.Session
|
|
|
|
new DeviceQuery
|
|
|
|
new DeviceQuery
|
|
|
|
{
|
|
|
|
{
|
|
|
|
DeviceId = deviceId,
|
|
|
|
DeviceId = deviceId,
|
|
|
|
UserId = user.Id,
|
|
|
|
UserId = user.Id
|
|
|
|
Limit = 1
|
|
|
|
}).ConfigureAwait(false)).Items;
|
|
|
|
}).ConfigureAwait(false)).Items.FirstOrDefault();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (existing is not null)
|
|
|
|
foreach (var auth in existing)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_logger.LogInformation("Reusing existing access token: {Token}", existing.AccessToken);
|
|
|
|
try
|
|
|
|
return existing.AccessToken;
|
|
|
|
{
|
|
|
|
|
|
|
|
// Logout any existing sessions for the user on this device
|
|
|
|
|
|
|
|
await Logout(auth).ConfigureAwait(false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.LogError(ex, "Error while logging out existing session.");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("Creating new access token for user {0}", user.Id);
|
|
|
|
_logger.LogInformation("Creating new access token for user {0}", user.Id);
|
|
|
|