fix(LinkedAccounts): update linked accounts to account for new redirect flow

This commit is contained in:
Michael Thomas
2025-05-26 22:59:10 -04:00
parent 80217c70ea
commit 27292c02ea
2 changed files with 7 additions and 4 deletions

View File

@@ -12,11 +12,11 @@ import defineMessages from '@app/utils/defineMessages';
import PlexOAuth from '@app/utils/plex';
import { TrashIcon } from '@heroicons/react/24/solid';
import { MediaServerType } from '@server/constants/server';
import axios from 'axios';
import type {
UserSettingsLinkedAccount,
UserSettingsLinkedAccountResponse,
} from '@server/interfaces/api/userSettingsInterfaces';
import axios from 'axios';
import { useRouter } from 'next/router';
import { useMemo, useState } from 'react';
import { useIntl } from 'react-intl';
@@ -158,8 +158,11 @@ const UserLinkedAccountsSettings = () => {
},
...settings.currentSettings.openIdProviders.map((p) => ({
name: p.name,
action: () => {
window.location.href = `/api/v1/auth/oidc/login/${p.slug}`;
action: async () => {
const res = await fetch(`/api/v1/auth/oidc/login/${p.slug}`);
if (!res.ok) setError(intl.formatMessage(messages.errorUnknown));
const json = await res.json();
window.location.href = json.redirectUrl;
},
hide: accounts.some(
(a) =>

View File

@@ -289,7 +289,7 @@ CoreApp.getInitialProps = async (initialProps) => {
if (
router.pathname.match(/(setup|login)/) &&
!router.pathname.includes('oidc')
!router.query.callback === true
) {
ctx.res.writeHead(307, {
Location: '/',