Skip to content

Commit 10a2f6f

Browse files
committed
fix: address remaining PR review comments
- Replace console.error with centralized logger in jellyfin-sign-in-button - Add comprehensive JSDoc documentation for Jellyfin token strategy - Document why AccessToken is not persisted in database All components already have data-testid attributes as required. Linting, build, and all unit tests passing.
1 parent 4914480 commit 10a2f6f

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

components/auth/jellyfin-sign-in-button.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22

33
import { Button } from "@/components/ui/button"
44
import { StyledInput } from "@/components/ui/styled-input"
5+
import { createLogger } from "@/lib/utils/logger"
56
import { signIn } from "next-auth/react"
67
import { FormEvent, useState } from "react"
78

9+
const logger = createLogger("JELLYFIN_SIGN_IN")
10+
811
export interface JellyfinSignInButtonProps {
912
/**
1013
* Server name to display in messages
@@ -93,7 +96,7 @@ export function JellyfinSignInButton({
9396
setIsLoading(false)
9497
}
9598
} catch (err) {
96-
console.error('Sign-in error:', err)
99+
logger.error('Sign-in error', err)
97100
let errorMsg = "Failed to sign in. Please try again."
98101

99102
// Provide more specific error messages based on error type

lib/jellyfin-auth.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,20 @@ const JellyfinCredentialsSchema = z.object({
4444
/**
4545
* Authenticate a Jellyfin user with username and password
4646
*
47+
* This function validates user credentials against the Jellyfin server and returns
48+
* user information if authentication is successful.
49+
*
50+
* ## Token Strategy
51+
*
52+
* The Jellyfin API returns an AccessToken upon successful authentication. However,
53+
* this token is **not persisted** in the application database. Instead:
54+
* - The token is used only for session validation during the authentication flow
55+
* - The app uses the configured admin API key for all Jellyfin API operations
56+
* - Users authenticate with username/password on each login session
57+
*
58+
* This approach simplifies token management and refresh logic while maintaining
59+
* security through NextAuth session management.
60+
*
4761
* @param jellyfinConfig - Server configuration (URL and API key)
4862
* @param username - Jellyfin username
4963
* @param password - User's password

0 commit comments

Comments
 (0)