Skip to content

Commit

Permalink
add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
arosiclair committed Jan 22, 2024
1 parent 599c005 commit 95f6022
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/pages/LogInWithShortLivedAuthTokenPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import * as Session from '@userActions/Session';
import ONYXKEYS from '@src/ONYXKEYS';
import type SCREENS from '@src/SCREENS';
import type {Account} from '@src/types/onyx';
import Log from '@libs/Log';

type LogInWithShortLivedAuthTokenPageOnyxProps = {
/** The details about the account that the user is signing in with */
Expand All @@ -38,6 +39,7 @@ function LogInWithShortLivedAuthTokenPage({route, account}: LogInWithShortLivedA

// Try to authenticate using the shortLivedToken if we're not already trying to load the accounts
if (token && !account?.isLoading) {
Log.info('LogInWithShortLivedAuthTokenPage - Successfully received shortLivedAuthToken. Signing in...');
Session.signInWithShortLivedAuthToken(email, token);
return;
}
Expand Down
2 changes: 2 additions & 0 deletions src/pages/LogOutPreviousUserPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import React, {useEffect} from 'react';
import {Linking} from 'react-native';
import {withOnyx} from 'react-native-onyx';
import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator';
import Log from '@libs/Log';
import * as SessionUtils from '@libs/SessionUtils';
import * as Session from '@userActions/Session';
import ONYXKEYS from '@src/ONYXKEYS';
Expand Down Expand Up @@ -51,6 +52,7 @@ function LogOutPreviousUserPage(props) {
// On Enabling 2FA, authToken stored in Onyx becomes expired and hence we need to fetch new authToken
const shouldForceLogin = lodashGet(props, 'route.params.shouldForceLogin', '') === 'true';
if (shouldForceLogin) {
Log.info('LogOutPreviousUserPage - forcing login with shortLivedAuthToken');
const email = lodashGet(props, 'route.params.email', '');
const shortLivedAuthToken = lodashGet(props, 'route.params.shortLivedAuthToken', '');
Session.signInWithShortLivedAuthToken(email, shortLivedAuthToken);
Expand Down
3 changes: 3 additions & 0 deletions src/pages/signin/SAMLSignInPage/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import HeaderWithBackButton from '@components/HeaderWithBackButton';
import SAMLLoadingIndicator from '@components/SAMLLoadingIndicator';
import ScreenWrapper from '@components/ScreenWrapper';
import getPlatform from '@libs/getPlatform';
import Log from '@libs/Log';
import Navigation from '@libs/Navigation/Navigation';
import * as Session from '@userActions/Session';
import CONFIG from '@src/CONFIG';
Expand Down Expand Up @@ -36,13 +37,15 @@ function SAMLSignInPage({credentials}) {
*/
const handleNavigationStateChange = useCallback(
({url}) => {
Log.info('SAMLSignInPage - Handling SAML navigation change');
// If we've gotten a callback then remove the option to navigate back to the sign in page
if (url.includes('loginCallback')) {
shouldShowNavigation(false);
}

const searchParams = new URLSearchParams(new URL(url).search);
if (searchParams.has('shortLivedAuthToken')) {
Log.info('SAMLSignInPage - Successfully received shortLivedAuthToken. Signing in...');
const shortLivedAuthToken = searchParams.get('shortLivedAuthToken');
Session.signInWithShortLivedAuthToken(credentials.login, shortLivedAuthToken);
}
Expand Down

0 comments on commit 95f6022

Please sign in to comment.