From 6d7ade91ffdf702f56c558a6fe45520b38696f6b Mon Sep 17 00:00:00 2001 From: Kevin Midboe Date: Fri, 27 Feb 2026 17:13:38 +0100 Subject: [PATCH] Implement Plex OAuth authentication with popup flow - Replace username/password with OAuth flow - Generate PIN and open popup to app.plex.tv/auth - Safari-compatible: open popup immediately, navigate after PIN generation - Poll PIN status every second for authentication - Custom loading screen in popup while generating PIN - Plex orange button (#c87818) with icon - Update API to accept authToken instead of credentials - Cleanup on component unmount and popup close - Handle popup blockers with user-friendly error messages --- src/api.ts | 6 +- src/components/settings/PlexSettings.vue | 790 +++++++++++++++++++++++ 2 files changed, 793 insertions(+), 3 deletions(-) create mode 100644 src/components/settings/PlexSettings.vue diff --git a/src/api.ts b/src/api.ts index aaae015..5658968 100644 --- a/src/api.ts +++ b/src/api.ts @@ -373,9 +373,9 @@ const updateSettings = async (settings: any) => { // - - - Authenticate with plex - - - -const linkPlexAccount = async (username: string, password: string) => { +const linkPlexAccount = async (authToken: string) => { const url = new URL("/api/v1/user/link_plex", API_HOSTNAME); - const body = { username, password }; + const body = { authToken }; const options: RequestInit = { method: "POST", @@ -387,7 +387,7 @@ const linkPlexAccount = async (username: string, password: string) => { return fetch(url.href, options) .then(resp => resp.json()) .catch(error => { - console.error(`api error linking plex account: ${username}`); // eslint-disable-line no-console + console.error("api error linking plex account"); // eslint-disable-line no-console throw error; }); }; diff --git a/src/components/settings/PlexSettings.vue b/src/components/settings/PlexSettings.vue new file mode 100644 index 0000000..c368bd1 --- /dev/null +++ b/src/components/settings/PlexSettings.vue @@ -0,0 +1,790 @@ + + + + +