MM-62411 Retrying SSO does not trigger a redirect (#8458)

* The server url is being registered as invalid.
Even if the URL is valid upon retry, it is still being registered as invalid.

* Delete unnecessary import

* Delete serverUrl

* Delete serverUrl props on test
This commit is contained in:
kondo 2025-01-16 21:02:23 +09:00 committed by GitHub
parent 4b068889e7
commit 52e05fba13
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 2 additions and 13 deletions

View file

@ -161,14 +161,12 @@ const SSO = ({
authentication = (
<SSOAuthenticationWithExternalBrowser
{...props}
serverUrl={serverUrl!}
/>
);
} else {
authentication = (
<SSOAuthentication
{...props}
serverUrl={serverUrl!}
/>
);
}

View file

@ -22,7 +22,6 @@ describe('SSO with redirect url', () => {
intl: {},
loginError: '',
loginUrl: '',
serverUrl: 'http://localhost:8065',
setLoginError: jest.fn(),
theme: Preferences.THEMES.denim,
};

View file

@ -9,7 +9,6 @@ import {Linking, Platform, StyleSheet, View, type EventSubscription} from 'react
import urlParse from 'url-parse';
import {Sso} from '@constants';
import NetworkManager from '@managers/network_manager';
import {isBetaApp} from '@utils/general';
import AuthError from './components/auth_error';
@ -20,7 +19,6 @@ interface SSOAuthenticationProps {
doSSOLogin: (bearerToken: string, csrfToken: string) => void;
loginError: string;
loginUrl: string;
serverUrl: string;
setLoginError: (value: string) => void;
theme: Theme;
}
@ -32,7 +30,7 @@ const style = StyleSheet.create({
},
});
const SSOAuthentication = ({doSSOLogin, loginError, loginUrl, serverUrl, setLoginError, theme}: SSOAuthenticationProps) => {
const SSOAuthentication = ({doSSOLogin, loginError, loginUrl, setLoginError, theme}: SSOAuthenticationProps) => {
const [error, setError] = useState<string>('');
const [loginSuccess, setLoginSuccess] = useState(false);
const intl = useIntl();
@ -47,8 +45,6 @@ const SSOAuthentication = ({doSSOLogin, loginError, loginUrl, serverUrl, setLogi
if (resetErrors !== false) {
setError('');
setLoginError('');
NetworkManager.invalidateClient(serverUrl);
NetworkManager.createClient(serverUrl);
}
const parsedUrl = urlParse(loginUrl, true);
const query: Record<string, string> = {

View file

@ -8,7 +8,6 @@ import {Linking, Platform, View} from 'react-native';
import urlParse from 'url-parse';
import {Sso} from '@constants';
import NetworkManager from '@managers/network_manager';
import {isErrorWithMessage} from '@utils/errors';
import {isBetaApp} from '@utils/general';
import {changeOpacity, makeStyleSheetFromTheme} from '@utils/theme';
@ -23,7 +22,6 @@ interface SSOWithRedirectURLProps {
doSSOLogin: (bearerToken: string, csrfToken: string) => void;
loginError: string;
loginUrl: string;
serverUrl: string;
setLoginError: (value: string) => void;
theme: Theme;
}
@ -59,7 +57,7 @@ const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => {
};
});
const SSOAuthenticationWithExternalBrowser = ({doSSOLogin, loginError, loginUrl, serverUrl, setLoginError, theme}: SSOWithRedirectURLProps) => {
const SSOAuthenticationWithExternalBrowser = ({doSSOLogin, loginError, loginUrl, setLoginError, theme}: SSOWithRedirectURLProps) => {
const [error, setError] = useState<string>('');
const [loginSuccess, setLoginSuccess] = useState(false);
const style = getStyleSheet(theme);
@ -75,8 +73,6 @@ const SSOAuthenticationWithExternalBrowser = ({doSSOLogin, loginError, loginUrl,
if (resetErrors !== false) {
setError('');
setLoginError('');
NetworkManager.invalidateClient(serverUrl);
NetworkManager.createClient(serverUrl);
}
const parsedUrl = urlParse(loginUrl, true);
const query: Record<string, string> = {