格子节点 SDK sandboxPublicTokenCreate() 返回 INVALID_PUBLIC_TOKEN
Plaid node SDK sandboxPublicTokenCreate() returning INVALID_PUBLIC_TOKEN
我正在尝试使用 sandboxPublicTokenCreate() 获取要在我的测试中使用的 public 令牌,但我一直返回 400 错误,例如:
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
}
我已经按照 https://plaid.com/docs/api/sandbox/ 上的示例文档进行操作,并尝试使用 Axios 手动执行请求,结果相同:
这是我的代码:
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 })
}
抱歉,我正在使用 Polly 记录请求,但它正在重播错误的响应。我会尽快关闭它。
我正在尝试使用 sandboxPublicTokenCreate() 获取要在我的测试中使用的 public 令牌,但我一直返回 400 错误,例如:
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
}
我已经按照 https://plaid.com/docs/api/sandbox/ 上的示例文档进行操作,并尝试使用 Axios 手动执行请求,结果相同:
这是我的代码:
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 })
}
抱歉,我正在使用 Polly 记录请求,但它正在重播错误的响应。我会尽快关闭它。