Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't connect a different bank account after successfully connecting an Oauth account #259

Open
jonathanadler opened this issue May 15, 2022 · 0 comments

Comments

@jonathanadler
Copy link

jonathanadler commented May 15, 2022

Hey

First of all thanks for this great product and react library!

I've set-up my project to work pretty much like the oauth example here.
The flow works pretty good, however, in my app I need to allow the user to select additional bank accounts.
This means that after connecting an OAuth bank, the user might try to connect another bank.

However, any additional tries to open plaid leads to the previous "update" mode flow.

This seems to be happening because the useEffect inside the usePlaidLink hook doesn't add the receivedRedirectUri prop to its dependency array.

I can create a PR to fix this if needed, unless this was intentional.

My current workaround is to remove my linkToken, and then add it back after an animation frame.
ie:

  const onEvent = (event: string, metadata: PlaidLinkOnEventMetadata) => {
    if (metadata.error_code === 'OAUTH_STATE_ID_ALREADY_PROCESSED') {
      const prevLinkToken = linkToken;
      setLinkToken('');
      requestAnimationFrame(() => {
        setLinkToken(prevLinkToken);
      });
    }
  };

Thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant