Skip to content

fix: replace deprecated Plex v1 invite endpoints with v2 API for auto-accept#119

Merged
engels74 merged 2 commits intomainfrom
fix/plex-auto-accept-invites
Mar 6, 2026
Merged

fix: replace deprecated Plex v1 invite endpoints with v2 API for auto-accept#119
engels74 merged 2 commits intomainfrom
fix/plex-auto-accept-invites

Conversation

@engels74
Copy link
Copy Markdown
Owner

@engels74 engels74 commented Mar 6, 2026

Summary

  • Replace plexapi's deprecated v1 invite endpoints (/api/invites/requests, which now return 410 Gone) with direct HTTP calls to the Plex v2 API (/api/v2/shared_servers/invites/received/pending and /api/v2/shared_servers/{id}/accept)
  • Add retry logic (3 attempts, 1s delay) to handle invite propagation delay after the shared_servers POST
  • Enhance logging: info level for invite status, warning level for exceptions (previously debug), and include auto_accepted in the plex_library_shared_direct log event

Context

plexapi 4.18's pendingInvites() and acceptInvite() use Plex v1 endpoints that Plex has retired (returns 410 Gone). The auto-accept block caught the resulting exception at debug level and swallowed it, causing users to need manual acceptance at plex.tv after OAuth redemption.

This is the same issue reported upstream in python-plexapi#1536, with a fix proposed in pushingkarmaorg/python-plexapi#1537 (still unmerged). The approach here mirrors how Wizarr solved the same problem.

Test plan

  • 77/77 plex client property tests pass (5 new tests for v2 auto-accept)
  • 548/548 full backend test suite passes
  • basedpyright: 0 errors, 0 warnings
  • ruff check + ruff format: clean
  • Manual test: create invitation, redeem via Plex OAuth, verify auto_accepted=True in logs and immediate library access

…-accept

plexapi 4.18's pendingInvites()/acceptInvite() call deprecated Plex v1
endpoints (/api/invites/requests) that now return 410 Gone. This caused
the auto-accept mechanism to silently fail, requiring users to manually
accept library invitations at plex.tv after OAuth redemption.

Replace the plexapi calls with direct HTTP requests to the Plex v2 API:
- GET /api/v2/shared_servers/invites/received/pending
- POST /api/v2/shared_servers/{id}/accept

Also add retry logic (3 attempts, 1s delay) for invite propagation,
enhance logging at info/warning levels, and include auto_accepted in
the share log event.
@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented Mar 6, 2026

🤖 Augment PR Summary

Summary: Updates Plex direct-share auto-accept to use Plex�s v2 invite APIs instead of plexapi�s deprecated v1 invite endpoints.

Why: Plex�s v1 invite endpoints (used by plexapi 4.18 for pending/accept) now return 410 Gone, causing auto-accept to fail and requiring manual acceptance on plex.tv.

Changes:

  • Replace v1-based pendingInvites()/acceptInvite() usage with direct HTTP calls to /api/v2/shared_servers/invites/received/pending and /api/v2/shared_servers/{id}/accept
  • Add retry logic (3 attempts, 1s delay) to handle invite propagation delay after shared_servers creation
  • Improve observability with info-level invite status logs and warning-level exception logs (including attempt count)
  • Include auto_accepted in the plex_library_shared_direct log event

Technical Notes: The new flow executes in asyncio.to_thread and adds property tests/mocks validating success, retry, and error logging behavior.

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 3 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread backend/src/zondarr/media/providers/plex/client.py Outdated
Comment thread backend/src/zondarr/media/providers/plex/client.py Outdated
Comment thread backend/src/zondarr/media/providers/plex/client.py
@engels74 engels74 merged commit 9ab4b27 into main Mar 6, 2026
2 of 3 checks passed
@engels74 engels74 deleted the fix/plex-auto-accept-invites branch March 6, 2026 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant