Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

252
Views
Plaid node SDK sandboxPublicTokenCreate() returning INVALID_PUBLIC_TOKEN

I'm trying to use sandboxPublicTokenCreate() to get a public token to use in my tests, but I keeps returning a 400 error like:

data: {
          display_message: null,
          documentation_url: 'https://plaid.com/docs/?ref=error#invalid-input-errors',
          error_code: 'INVALID_PUBLIC_TOKEN',
          error_message: 'provided public token is in an invalid format. expected format: public-<environment>-<identifier>',
          error_type: 'INVALID_INPUT',
          request_id: '2yEEbS5QI993pZj',
          suggested_action: null
        }

I've followed the example docs at https://plaid.com/docs/api/sandbox/ and tried manually executing the request with Axios, with same result:

Here's my code:

import { Configuration, PlaidApi, PlaidEnvironments, Products, SandboxPublicTokenCreateRequest } from 'plaid'

/**
   * Returns a public token we can use for testing tied to the Royal Bank of Plaid
   *
   * @returns {Promise<string>}
   * @memberof BankAccountService
   */
  public async getPublicTokenForTesting(): Promise<string> {
    const institutionId = 'ins_117650'
    const initialProducts = [Products.Assets, Products.Balance]

    const publicTokenRequest: SandboxPublicTokenCreateRequest = {
      institution_id: institutionId,
      initial_products: initialProducts
    }

    try {
      const CONFIG = new Configuration({
        basePath: PlaidEnvironments[process.env.PLAID_ENV],
        baseOptions: {
          headers: {
            'PLAID-CLIENT-ID': process.env.PLAID_CLIENT_ID,
            'PLAID-SECRET': process.env.PLAID_SECRET
          }
        }
      })

      const client = new PlaidApi(CONFIG)
      const publicTokenResponse = await client.sandboxPublicTokenCreate(publicTokenRequest)
      const publicToken = publicTokenResponse.data.public_token

      return publicToken
    } catch (e) {
      console.error({ response: e.response })
    }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Apologies, I was using Polly to record requests and it was replaying a bad response. Will close this as soon as SO lets me.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!