diff --git a/src/pages/signin/SAMLSignInPage/index.native.js b/src/pages/signin/SAMLSignInPage/index.native.js
index 3825cca0fa97..369250b97b66 100644
--- a/src/pages/signin/SAMLSignInPage/index.native.js
+++ b/src/pages/signin/SAMLSignInPage/index.native.js
@@ -1,11 +1,18 @@
import React, {useCallback, useRef} from 'react';
+import {View, ActivityIndicator, StyleSheet} from 'react-native';
import {withOnyx} from 'react-native-onyx';
import PropTypes from 'prop-types';
+import WebView from 'react-native-webview';
+import HeaderWithBackButton from '../../../components/HeaderWithBackButton';
import ONYXKEYS from '../../../ONYXKEYS';
import CONFIG from '../../../CONFIG';
-import WebView from 'react-native-webview';
-import FullScreenLoadingIndicator from '../../../components/FullscreenLoadingIndicator';
import * as Session from '../../../libs/actions/Session';
+import Navigation from '../../../libs/Navigation/Navigation';
+import ROUTES from '../../../ROUTES';
+import ScreenWrapper from '../../../components/ScreenWrapper';
+import styles from '../../../styles/styles';
+import themeColors from '../../../styles/themes/default';
+import FullPageOfflineBlockingView from '../../../components/BlockingViews/FullPageOfflineBlockingView';
const propTypes = {
/** The credentials of the logged in person */
@@ -19,39 +26,61 @@ const defaultProps = {
credentials: {},
};
-const renderLoading = () => ;
+// const renderLoading = () => ;
function SAMLSignInPage({credentials}) {
const webViewRef = useRef();
const samlLoginURL = `${CONFIG.EXPENSIFY.SAML_URL}?email=${credentials.login}&referer=${CONFIG.EXPENSIFY.EXPENSIFY_CASH_REFERER}`;
-
/**
- * Handles in-app navigation once we get a response back from Expensify
- *
- * @param {String} params.type
- * @param {String} params.url
- */
+ * Handles in-app navigation once we get a response back from Expensify
+ *
+ * @param {String} params.type
+ * @param {String} params.url
+ */
const handleNavigationStateChange = useCallback(
({type, url}) => {
const searchParams = new URLSearchParams(new URL(url).search);
if (searchParams.has('shortLivedAuthToken')) {
const shortLivedAuthToken = searchParams.get('shortLivedAuthToken');
Session.signInWithShortLivedAuthToken(credentials.login, shortLivedAuthToken);
- return;
+ Navigation.navigate(ROUTES.HOME);
+ }
+ if (searchParams.has('error')) {
+ // Run the Onyx action to set an error state on the sign in page
+ // Currently this is what's going to trigger because the backend isn't redirecting SAML correctly
+ Navigation.navigate(ROUTES.HOME);
}
},
- [webViewRef],
+ [credentials.login],
);
return (
-
+
+ Navigation.navigate(ROUTES.HOME)}
+ />
+
+ (
+
+
+
+ )}
+ onNavigationStateChange={handleNavigationStateChange}
+ />
+
+
);
}