簡體   English   中英

格子的 LinkTokenCreate 在 node.js 中給出 400 錯誤

[英]Plaid's LinkTokenCreate giving 400 error in node.js

有其他人對 Plaid 的 linkTokenCreate 方法有問題嗎? 我使用 node.js 作為后端,當我在前端運行它時,錯誤從涉及此 function 的行開始。

即使我使用標准的快速入門選項,我仍然會收到相同的 400 bad request 錯誤。

這是后端代碼,與快速入門相同。 我只是在測試鏈接令牌,所以它是我定義的唯一路線。

app.post('/create_link_token', function (request, response, next)  {
    console.log('HI THERE')
    Promise.resolve()
    .then(async function () {
        const configs = {
            user: {
                //this should be a unique id for the current user.
                client_user_id: 'user-id',
            },
            client_name: 'Plaid Quickstart', 
            products: PLAID_PRODUCTS, 
            country_codes: PLAID_COUNTRY_CODES, 
            language: 'en',
        };

        console.log(configs);

        // if (PLAID_REDIRECT_URI !== '') {
        //     configs.redirect_uri = PLAID_REDIRECT_URI;
        // };

        const createTokenResponse = await client.linkTokenCreate(configs);
        console.log(createTokenResponse);
        prettyPrintResponse(createTokenResponse);
        response.json(createTokenResponse.data);
        
    })
    .catch(next);
});

這是錯誤:

 Error: Request failed with status code 400 at createError (C:\Users\MyComputer\Desktop\mukadi\plaid-integration\backend\node_modules\axios\lib\core\createError.js:16:15) at settle (C:\Users\MyComputer\Desktop\mukadi\plaid-integration\backend\node_modules\axios\lib\core\settle.js:17:12) at IncomingMessage.handleStreamEnd (C:\Users\MyComputer\Desktop\mukadi\plaid-integration\backend\node_modules\axios\lib\adapters\http.js:269:11) at IncomingMessage.emit (node:events:402:35) at endReadableNT (node:internal/streams/readable:1343:12) at processTicksAndRejections (node:internal/process/task_queues:83:21)

可能是 your.env 文件的問題。 你檢查過日志嗎? https://dashboard.plaid.com/activity/logs應該向您顯示請求並包含錯誤的詳細信息。

可能很傻 - 但是當我得到這個確切的錯誤時,那是因為我們沒有在我們的格子儀表板中注冊我們的 URI。

注冊您的重定向 URI:

登錄格子儀表板和 go 到團隊設置 -> API 頁面。 在允許的重定向 URI 旁邊單擊配置,然后單擊添加新 URI。 輸入您的重定向 URI,您還必須將其設置為應用程序的通用鏈接,例如: https://app.example.com/plaid/ 單擊保存更改。

它也可能是 API 的版本

使用版本 Java 啟動您的 API:

apiKeys.put("plaidVersion", "2020-09-14");

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM