Search code examples
node.jssandboxmulti-factor-authenticationplaid

How do I invoke Link Update Mode in the Plaid Sandbox Quickstart app (node.js)?


I have the Plaid Quickstart (node) up and running.

I successfully logged in to one of the sandbox institutions (First Platypus Bank) using the sandbox credentials and got the access_token which it generated.

Per the Link Update Mode docs (https://plaid.com/docs/link/update-mode/), you should be able to "force a given Item into an ITEM_LOGIN_REQUIRED state".

From the docs I linked to above...

Update mode can be tested in the Sandbox using the /sandbox/item/reset_login endpoint, which will force a given Item into an ITEM_LOGIN_REQUIRED state.

I used Postman (in the Sandbox Public environment) to send an API call to this endpoint, https://sandbox.plaid.com/sandbox/item/reset_login, to force the ITEM_LOGIN_REQUIRED state.

This is the body sent with the API call...

{
  "client_id": "{{client_id}}",
  "secret": "{{secret_key}}",
  "client_name": "Insert Client name here",
  "country_codes": ["US"],
  "language": "en",
  "user": {
  "client_user_id": "unique_user_id"
},
  "access_token": "{{access_token}}"
}

This is the response I got back...

{
  "expiration": "2021-02-13T04:13:12Z",
  "link_token": "link-sandbox-7d82e9b8-b8a7-4977-9c20-aadbc82ec050",
  "request_id": "eE56J8f5XJKpS6L"
}

...which is what I expected.

I then went back in to the Quickstart app and logged in to the "First Platypus Bank" again expecting to be prompted for the MFA challenges, but, instead, it just created a new access_token.

So, how to I get the Plaid Quickstart app into Link Update mode?

Update:

Per Alex's question, here is an image showing the Postman call I made. He's correct, it was a /link/token/create call. What's confusing it that it's labeled Create Link Token - Update Mode.

Postman

Update 2:

Here's the /sandbox/item/reset_login call and response. There's no link_token included in the response.

Postman 2

Update 3:

Between Alex's help and some help from Plaid support, I got this working.

I was putting the link token in the wrong place.

For anyone seeing this in the future, here are the steps you need to follow to get the node quickstart app into Link Update Mode.

You can also watch this video to see a demo of the process; HOWEVER, note that in the video, I put the link_token in the wrong place. The instructions below show how to put it in the correct place.

  • Get the access_token for the institution you want to get into Link Update Mode (this assumes you have the quickstart app installed, up and running. See... https://plaid.com/docs/quickstart/)
    • Start the quickstart backend (/quickstart/node/start.sh)
    • Start the quickstart frontend (cd /quickstart/frontend; npm start;)
    • Once the frontend fires up on port 3000 in your browser, click the "Launch Link" button then click "Continue".
    • Search for the institution (e.g., First Platypus Bank, First Gingham Credit Union...if in sandbox mode. or your own institution if in dev mode)
    • Enter your credentials (user_good/pass_good ...if in sandbox mode)
    • Copy the access_token
    • Close the Plaid browser tab
  • In Postman (to set this up, see... https://github.com/plaid/plaid-postman), enter the access token you just copied into the access_token variable (See the first screenshot above. Click on the icon near the upper right-hand side that looks like an eye then scroll down to access_token and enter it.)
    • Run the /sandbox/item/reset_login endpoint. It's labeled "Simulate ITEM_LOGIN_REQUIRED [Sandbox only]" in Postman. The request body should look like second screenshot above. Once you Send the request, the response body should show "reset_login": true. Now the Plaid Item (i.e., the institution) is in ITEM_LOGIN_REQUIRED mode.
    • Run the /link/token/create endpoint. It's labeled "Create Link Token - Update Mode" in Postman. The request body should look like the first screenshot above. Once you Send the request, the response body should give you a link_token. Copy it for the next step.
  • Put the link_token in the Plaid quickstart app.
    • On line 23 in /quickstart/frontend/src/App.tsx, replace data.link_token with your link_token. So this dispatch({ type: "SET_STATE", state: { linkToken: data.link_token } }); becomes this dispatch({ type: "SET_STATE", state: { linkToken: "link-sandbox-704ef648-2acd-44a2-867b-ea1258e9205c" } }); (Use your own link_token, of course, and don't forget the quotes around your link_token.)
  • Restart the backend and frontend. When you launch Link, it should now be in Link Update Mode.

Solution

  • The process you describe sounds right, but the API request and response bodies in your post are the request and response for /link/token/create, not /sandbox/item/reset_login. Can you verify that you didn't accidentally call /link/token/create instead of calling /sandbox/item/reset_login?