From 71b01ca5a9f511f6e7c814c3ee173592a7ec011e Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Fri, 22 May 2026 17:07:15 +0300 Subject: Implement API token management screen in Settings (task hb) Adds ApiTokensScreen (/settings/api-tokens) so any authenticated user can list, create (with optional expiry), and revoke their own Bearer API tokens. The plaintext token is displayed exactly once after creation with a clipboard copy button. Create and revoke use optimistic UI with proper revert on error. Co-Authored-By: Claude Sonnet 4.6 --- player-android/lib/screens/settings_screen.dart | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'player-android/lib/screens/settings_screen.dart') diff --git a/player-android/lib/screens/settings_screen.dart b/player-android/lib/screens/settings_screen.dart index 2fc034c..bea9d13 100644 --- a/player-android/lib/screens/settings_screen.dart +++ b/player-android/lib/screens/settings_screen.dart @@ -165,6 +165,21 @@ class _SettingsScreenState extends ConsumerState { ), const SizedBox(height: 24), + // API Tokens tile — navigates to /settings/api-tokens. + // Available to all authenticated users (not admin-only) so they + // can manage their own Bearer tokens for external integrations. + ListTile( + key: const Key('settings_api_tokens'), + contentPadding: EdgeInsets.zero, + leading: const Icon(Icons.key_outlined), + title: const Text('API Tokens'), + subtitle: const Text('Create and revoke Bearer API tokens'), + trailing: const Icon(Icons.chevron_right), + onTap: () => context.go(AppRoutes.apiTokens), + ), + + const SizedBox(height: 24), + // Logout button: shows a spinner while the token is being deleted. _isLoggingOut ? const Center(child: CircularProgressIndicator()) -- cgit v1.2.3