Skip to content

fix(jellyfin): use correct two-step QuickConnect authentication flow - #57

Merged
koinsaari merged 1 commit into
mainfrom
fix/quickconnect-two-step-auth
Jul 20, 2026
Merged

fix(jellyfin): use correct two-step QuickConnect authentication flow#57
koinsaari merged 1 commit into
mainfrom
fix/quickconnect-two-step-auth

Conversation

@koinsaari

Copy link
Copy Markdown
Contributor

/QuickConnect/Authenticate isn't a real Jellyfin endpoint — it only reports approval state and never returns a token. A prior commit worked around this by treating its 400 response as "pending," which masked the real problem.

Summary

  • Poll /QuickConnect/Connect for Authenticated state
  • Once approved, exchange the secret for a token via /Users/AuthenticateWithQuickConnect
  • Update client and adapter tests to mock both endpoints

Implementation notes

Supersedes the 400-as-pending workaround from f0c9957 — that logic is now gone, replaced by the real two-call protocol.

🤖 Generated with Claude Code

@koinsaari koinsaari added the bug Something isn't working label Jul 20, 2026
@koinsaari koinsaari self-assigned this Jul 20, 2026
@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown

Reviewing PR #57

  • Read REVIEW.md and CLAUDE.md
  • Review diff (quickconnect.go, adapter_test.go, quickconnect_test.go)
  • Check import cycle rule (internal/auth vs internal/clients/jellyfin)
  • Post findings and set commit status

View job run

@koinsaari
koinsaari force-pushed the fix/quickconnect-two-step-auth branch from 5ac70ff to 56abae4 Compare July 20, 2026 14:59
@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown

Claude finished @koinsaari's task in 1m 22s —— View job


Reviewing PR #57

  • Read REVIEW.md and CLAUDE.md
  • Review diff (quickconnect.go, adapter_test.go, quickconnect_test.go)
  • Check import cycle rule (internal/auth vs internal/clients/jellyfin)
  • Post findings and set commit status

No blocking issues. The two-step flow is implemented correctly:

  • QuickConnect/Connect is polled via GET with secret as a query param, decoded into {Authenticated bool}, and ErrQuickConnectPending is returned when not yet approved — matches the actual Jellyfin contract described in the PR body.
  • Once approved, Users/AuthenticateWithQuickConnect is called via POST with the secret in a JSON body, and the resulting AccessToken/User are decoded the same way the old single-call path did.
  • URL construction uses url.JoinPath + url.Parse with errors handled (not fmt.Sprintf), consistent with CLAUDE.md.
  • No import of internal/clients/jellyfin inside internal/auth — the isolation rule holds.
  • Tests in quickconnect_test.go and adapter_test.go were updated to mock both endpoints and cover pending vs. approved paths.

🟡 Nit: both requests build authHeader("api-proxy-qc") independently — fine as-is, just noting it's not a hoisting issue since it's not a per-request closure.

Note: I was unable to run go build/go test/go vet in this sandbox (commands required approval that wasn't available in this context) — CI should confirm compilation and test pass, but the logic reads correct on inspection.

@koinsaari
koinsaari merged commit a2e9680 into main Jul 20, 2026
8 checks passed
@koinsaari
koinsaari deleted the fix/quickconnect-two-step-auth branch July 20, 2026 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant