Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3270,6 +3270,9 @@ const CONST = {
isLoading: false,
errors: {},
},
// Redirect URI used by the native Plaid SDK on iOS. It is not a registered app route —
// the SDK handles the OAuth callback itself, so deep-link handlers must ignore this path.
OAUTH_REDIRECT_PATH_IOS: 'partners/plaid/oauth_ios',
},

ONFIDO: {
Expand Down
7 changes: 0 additions & 7 deletions src/libs/Navigation/helpers/getAdaptedStateFromPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,13 +352,6 @@ const getAdaptedStateFromPath: GetAdaptedStateFromPath = (path, options, shouldR
normalizedPath = '/';
}

// The Plaid OAuth redirect URI for iOS (partners/plaid/oauth_ios) is not a registered route.
// When this URL is processed — either as a deep link or opened in Safari — redirect to home
// to avoid showing NotFound. The native Plaid SDK handles the actual OAuth callback separately.
if (normalizedPath.startsWith('/partners/plaid/oauth_ios')) {
normalizedPath = '/';
}

const state = getStateFromPath(normalizedPath as RoutePath) as PartialState<NavigationState<RootNavigatorParamList>>;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve Plaid callback fallback in path-to-state parsing

Removing the Plaid OAuth guard from getAdaptedStateFromPath means cold-start deep links like /partners/plaid/oauth_ios... now parse as an unknown route and resolve to NotFound. The new check in linkingConfig/subscribe.ts only covers runtime Linking events, not initial URL parsing at app launch, so users returning from Plaid when the app is relaunched can still be dropped out of the card import flow. Keeping a fallback in getAdaptedStateFromPath (or equivalent initial-URL handling) is needed to avoid this regression.

Useful? React with 👍 / 👎.

if (shouldReplacePathInNestedState) {
replacePathInNestedState(state, normalizedPath);
Expand Down
7 changes: 7 additions & 0 deletions src/libs/Navigation/linkingConfig/subscribe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {findFocusedRoute} from '@react-navigation/native';
import {Linking} from 'react-native';
import navigationRef from '@libs/Navigation/navigationRef';
import type {RootNavigatorParamList} from '@libs/Navigation/types';
import CONST from '@src/CONST';
import ROUTES from '@src/ROUTES';

const subscribe: LinkingOptions<RootNavigatorParamList>['subscribe'] = (listener) => {
Expand All @@ -19,6 +20,12 @@ const subscribe: LinkingOptions<RootNavigatorParamList>['subscribe'] = (listener
}
}
}
// The native Plaid SDK on iOS handles the OAuth callback itself. Forwarding this URL to
// React Navigation would resolve to NotFound (or reset navigation away from the Plaid step)
// and break the flow — keep the current screen mounted so the SDK can finish.
if (url.includes(CONST.PLAID.OAUTH_REDIRECT_PATH_IOS)) {
return;
}
listener(url);
});
return () => subscription.remove();
Expand Down
2 changes: 1 addition & 1 deletion src/libs/actions/Link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ function openReportFromDeepLink(
}

// The Plaid OAuth redirect URI is handled by the native Plaid SDK on iOS — skip navigation to avoid showing NotFound
if (route?.includes('partners/plaid/oauth_ios')) {
if (route?.includes(CONST.PLAID.OAUTH_REDIRECT_PATH_IOS)) {
return;
}

Expand Down
Loading