fix(LinkedAccounts): update linked accounts to account for new redirect flow
This commit is contained in:
@@ -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) =>
|
||||
|
||||
@@ -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: '/',
|
||||
|
||||
Reference in New Issue
Block a user