summaryrefslogtreecommitdiff
path: root/player-android/lib/screens/settings_screen.dart
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-05-22 17:07:15 +0300
committerPaul Buetow <paul@buetow.org>2026-05-22 17:07:15 +0300
commit71b01ca5a9f511f6e7c814c3ee173592a7ec011e (patch)
tree248c118034a30f78cc69d7d90454c730cf5d2688 /player-android/lib/screens/settings_screen.dart
parent32aa3946cc1a0f5166ecff59dc229d0c02c7e9b6 (diff)
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 <noreply@anthropic.com>
Diffstat (limited to 'player-android/lib/screens/settings_screen.dart')
-rw-r--r--player-android/lib/screens/settings_screen.dart15
1 files changed, 15 insertions, 0 deletions
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<SettingsScreen> {
),
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())