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

Handling an invalid link token #258

Open
asimonia opened this issue May 13, 2022 · 1 comment
Open

Handling an invalid link token #258

asimonia opened this issue May 13, 2022 · 1 comment

Comments

@asimonia
Copy link

asimonia commented May 13, 2022

Hello!

In my app using react hooks, I am trying trying to handle the case for an INVALID_LINK_TOKEN in the onExit callback for a component that is a button which fetches a token and passes the config to usePlaidLink(config). However, in the docs https://plaid.com/docs/link/handle-invalid-link-token/ the example given is this:

      linkHandler.destroy();
      linkHandler = Plaid.create({
        ...configs,
        // Fetch a new link_token because the old one was invalidated.
        token: (await $.post('/create_link_token')).link_token,
      });

For react hooks, what is the best practice here to destroy to the link instance (since it only gets destroyed and reinitialized on unmount) and create a new one? You can't call the hook again to re-initialize. Maybe wrap the hook in another component unless there is a manual way to unmount.

@mvelebit
Copy link

Also, is there a way to force this specific error in Sandbox in same-day microdeposits flow without having to wait 30 mins for the token to become invalid since I couldn't find it in the documentation?

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

2 participants