Search code examples
javasandboxplaid

Plaid Quickstart Issues (Java)


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!


Solution

  • 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.