diff --git a/src/components/UserProfile/UserSettings/UserLinkedAccountsSettings/index.tsx b/src/components/UserProfile/UserSettings/UserLinkedAccountsSettings/index.tsx index ec1754b6..7a38da01 100644 --- a/src/components/UserProfile/UserSettings/UserLinkedAccountsSettings/index.tsx +++ b/src/components/UserProfile/UserSettings/UserLinkedAccountsSettings/index.tsx @@ -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) => diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index c5b223bf..d8c4dec2 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -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: '/',