Search code examples
curlplaid

Plaid invalid access token


I'm having trouble connecting to Plaid's transactions/get endpoint. I have production credentials and they work for their Connect software but I'm unable to fetch transactions.

Here's what we're sending. The PRIVATE_ACCESS_TOKEN is the token we're getting from connect. It's 128 characters long and comes back in their response as access_token.

POST https://production.plaid.com/transactions/get


{
 "client_id": "<CLIENT_ID>",
 "secret": "<SECRET>",
 "access_token": "access-production-<PRIVATE_ACCESS_TOKEN>",
 "start_date": "2017-01-01",
 "end_date": "2017-02-01",
 "options": {
   "count": 250,
   "offset": 100
 }
}

However, this is what we get back:

{
  "display_message": null,
  "error_code": "INVALID_ACCESS_TOKEN",
  "error_message": "provided access token is an invalid format. expected format: access-<environment>-<identifier>",
  "error_type": "INVALID_INPUT",
  "request_id": "xXxXx"
}

I can't seem to find any information online for this error or any better explanations of what to do. I did try with sandbox, tartan, and development URLs as well but no luck. I'm using production just to make sure it's nothing weird with certain fields that need to be hardcoded to certain values like test_id.


Solution

  • After a couple days Plaid got back to me and told me I was using mixed V1 and V2 code. Many of their examples are V1, and, for example, their "latest" Plaid Java library is V1 only (unless you compile the source code for their V2 library) but their docs are all in V2. You have to hit https://plaid.com/docs/legacy/api/ to read the docs of V1. We ended up upgrading to V2 instead and everything is working.