Files
Libation/Source/LibationUiBase/AutoScanAuthPrompt.cs
William Tanksley Jr 4a70c41f65 feat(auth): upgrade AudibleApi to 14.1.3 and support Bearer tokens with graceful legacy fallback (#2148)
- Upgrade AudibleApi NuGet package reference from 14.1.2 to 14.1.3
- Support Bearer access token authentication alongside ADP request signing
- Proactively validate tokens and evaluate account SignInStatus (None, Modern, Legacy)
- Add tri-state 'Signed in?' checkbox in Avalonia and WinForms Accounts dialogs
- In ApiExtended, dynamically set Api.AuthenticationMethods based on tokens held by account
- Handle legacy credential rejections gracefully and guide user to re-authenticate
- In CLI, report modern vs legacy authentication status and support forced re-login
- Add comprehensive unit tests and user documentation
2026-11-12 18:42:09 -07:00

28 lines
1.1 KiB
C#

using AudibleUtilities;
using System;
namespace LibationUiBase;
/// <summary>Shared copy for the dialog shown when auto-scan pauses itself waiting for a login.</summary>
public static class AutoScanAuthPrompt
{
public const string Caption = "Auto-scan paused - login required";
public static string FormatBody(AuthenticationRequiredException ex)
{
ArgumentNullException.ThrowIfNull(ex);
// the owner is looking at their own screen, so the dialog names the account in full. the log gets
// ex.AccountInfo.MaskedLogEntry instead
var account = ex.AccountInfo?.RevealOwnerFacingLabel() ?? "an Audible account";
var cause = ex.AccountInfo?.RequiresReRegistration == true
? "that account requires a fresh login and device registration"
: ex.AccountInfo?.LooksLikeMissingCredentials ?? true
? "that account has never been logged in, or its stored credentials are missing"
: "the stored login for that account expired";
return $"Libation could not refresh the Audible library for {account} because {cause}.\n\n"
+ "Background auto-scan has been paused. Use Import > Scan Library to log in for that account and resume periodic scans.";
}
}