2

I am trying to implement Plaid using the sample code provided on the Java Quickstart [sandbox] and am getting issues when I show the Plaid Dialog (javascript). I am able to successfully get a link_token, but I'm never able to show the dialog. It spins for a brief second, then shows me:

oauth uri does not contain a valid oauth_state_id query parameter. Request ID: DBoT92FCo8AORay

I have tried this with an empty redirectUri, as well as "http://localhost:8080/plaid_test.html", which is registered in my developer account.

I am a bit stuck and hoping someone can direct me in the right direction. I've tested with both versions 9.10.0 and the latest (11.9.0).

Curiously, I am able to get the Java Quickstart working directly, but ONLY if I leave the .env PLAID_REDIRECT_URI blank. If I put localhost in there, it fails when trying to get the link token.

Does anyone have any suggestions on how to overcome this setup issue?

Thank you!

Evan Ruff
  • 582
  • 7
  • 21

2 Answers2

9

I got this error (oauth uri does not contain a valid oauth_state_id query parameter) while creating a new test application in Plaid's Sandbox environment.

Important note: My application does not use OAuth.

The problem turned out to be, in my configuration parameters being passed to usePlaidLink, I was including a receivedRedirectUri key-value pair. Removing that key-value pair entirely resolved the issue for me.

In other words, my React component looked something like:

import { usePlaidLink } from 'react-plaid-link';

function PlaidLink(props) {
    const onSuccess = React.useCallback((public_token, metadata) => {
        // ...
    });

    const config = {
        token: props.linkToken,
        receivedRedirectUri: window.location.href,
        onSuccess,
    };

    const { open, ready } = usePlaidLink(config);

    // ...
}

Removing the line with the receivedRedirectUri was the solution for me, getting me past the oauth uri does not contain a valid oauth_state_id query parameter error, and getting the Plaid Link UI to appear in my app successfully.

This Plaid article, which has a number of mentions of "OAuth state ID" (as mentioned in the error message), helped point me toward this solution.

Jon Schneider
  • 25,758
  • 23
  • 142
  • 170
  • 2
    Yeah, for some reason the example quick Start tutorial they have on their site includes `receivedRedirectUri` even though there's no mention of Oauth in the quick start. ‍♀️ oh well. Thanks for the answer, you saved me from smashing my head into my keyboard. – SomeGoodCodeHelp Dec 29 '22 at 20:47
0

The issue may be the location you are trying to use -- unless you have manually modified the ports or other code used by the Quickstart, you should use http://localhost:3000/ as the PLAID_REDIRECT_URI (make sure to add this to your Dashboard as an allowed redirect URI). When I tried this just now on the Java quickstart (non-Docker version) it worked fine.

Alex
  • 1,245
  • 1
  • 9
  • 10
  • Hey Alex, I switched the implementation to localhost:3000, thinking that sandbox might have been coded to port 3000, but I still get the same oauth error. – Evan Ruff Aug 18 '22 at 20:45
  • I'd recommend trying to use the Quickstart totally out of the box and with the latest client libraries to make sure that the issue isn't any code modifications on your side. If that doesn't work, can you submit a support ticket via the developer dashboard? – Alex Aug 19 '22 at 18:11
  • Hey Alex, it looks like I have a frontend issue with the sample Javascript from the Quickstart page. I connected the React app to my backend and everything works as expected. I wish the Quickstart came with a more vanilla JS implementation, as I'm not really familiar with React. I'll keep grinding! Thank you for all your help. – Evan Ruff Aug 20 '22 at 15:23
  • 1
    hey @EvanRuff there is a vanilla JS quickstart here: https://github.com/plaid/tiny-quickstart – Skylar Brown Aug 26 '22 at 16:02