Skip to content

[Components] plaid #15144

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pipedream-component-development opened this issue Jan 2, 2025 · 9 comments · Fixed by #16586
Closed

[Components] plaid #15144

pipedream-component-development opened this issue Jan 2, 2025 · 9 comments · Fixed by #16586
Assignees
Labels
triaged For maintainers: This issue has been triaged by a Pipedream employee

Comments

@pipedream-component-development
Copy link
Collaborator

pipedream-component-development commented Jan 2, 2025

plaid

URLs

Webhook Sources

new-accounts-available-instant

Prompt

Emit new event when there are new accounts available at the Financial Institution.

new-event-instant

Prompt

Emit new event when there are changes to Plaid Items or the status of asynchronous processes.

sync-updates-available-instant

Prompt

Emit new event when there are new updates available for a connected account.

Actions

create-access-token

Prompt

Exchange a Link public_token for an API access_token.

create-sandbox-public-token

Prompt

Creates a valid public_token for an arbitrary institution ID, initial products, and test credentials.

get-real-time-balance

Prompt

Get the real-time balance for each of an Item's accounts.

get-transactions

Prompt

Retrieves user-authorized transaction data for a specified date range.

@vunguyenhung vunguyenhung added the triaged For maintainers: This issue has been triaged by a Pipedream employee label Jan 6, 2025
@jcortes jcortes self-assigned this Apr 30, 2025
@jcortes jcortes moved this from To Do to Doing in Component (Source and Action) Backlog Apr 30, 2025
@jcortes
Copy link
Collaborator

jcortes commented May 2, 2025

Hi @sergio-eliot-rodriguez is not very clear to me if we need to create the accessToken from components or from the app registration window because seems like all endpoints require this accessToken in order to be called. I tried to undestand the flow by calling https://plaid.com/docs/api/sandbox/#sandboxpublic_tokencreate in order to get access to the public_key so then I can make a request to https://plaid.com/docs/api/items/#itempublic_tokenexchange to get the accesToken but I was facing API errors like:

{
  "display_message": null,
  "documentation_url": "https://plaid.com/docs/?ref=error#invalid-request-errors",
  "error_code": "INVALID_FIELD",
  "error_message": "invalid products or income source types",
  "error_type": "INVALID_REQUEST",
  "request_id": "Kf7gMub35FChZmg",
  "suggested_action": null
}

Which I didn't kown what that means and I couldn't fix it.

This is the step I was using to try to get the access token just in case you want to try it for yourself.

import { axios } from "@pipedream/platform";

export default defineComponent({
  props: {
    plaid: {
      type: "app",
      app: "plaid",
    }
  },
  methods: {
    getUrl(path) {
      const { environment: baseUrl } = this.plaid.$auth;
      return `${baseUrl}${path}`;
    },
    getHeaders(headers) {
      const {
        client_id: clientId,
        client_secret: clientSecret,
      } = this.plaid.$auth;
      return {
        ...headers,
        "PLAID-CLIENT-ID": clientId,
        "PLAID-SECRET": clientSecret,
        "Content-Type": "application/json",
      };
    },
    makeRequest({
      $ = this, path, headers, ...args
    } = {}) {
      return axios($, {
        debug: true,
        url: this.getUrl(path),
        headers: this.getHeaders(headers),
        ...args,
      });
    },
    post(args = {}) {
      return this.makeRequest({
        method: "POST",
        ...args,
      });
    },
    sandboxCreatePublicToken(args = {}) {
      return this.post({
        path: "/sandbox/public_token/create",
        ...args
      });
    }
  },
  async run({steps, $}) {
    const { sandboxCreatePublicToken } = this;
    return sandboxCreatePublicToken({
      $,
      data: {
        institution_id: "ins_130347",
        initial_products: [
          "assets",
          "auth",
          "identity",
          "identity_match",
          "income_verification",
          "investments",
          "liabilities",
          "signal",
          "transactions"
        ]
      }
    });
  },
})

So at this point I'm kind of stuck on this because the endpoints are not working at all and it is because I don't have the accessToken. So it would be helpful if you try to reach out dev support on this and see if they can help us out. Thanks in advance!

@jcortes jcortes moved this from Doing to Prioritized in Component (Source and Action) Backlog May 2, 2025
@sergio-eliot-rodriguez
Copy link
Collaborator

@jcortes would it be possible to try the plaid sdk instead of plain http calls?
this way, we may not have to call the endpoint to get access token. see the test request for plaid, e.g.:

const { Configuration, PlaidApi } = require('plaid');

const client = new PlaidApi(
  new Configuration({
    basePath: this.plaid.$auth.environment,
    baseOptions: {
      headers: {
        'PLAID-CLIENT-ID': this.plaid.$auth.client_id,
        'PLAID-SECRET': this.plaid.$auth.client_secret,
      },
    },
  })
);

// Test request
const request = {
  count: 10,
  offset: 0,
  country_codes: ['US'],
};

const response = await client.institutionsGet(request);
return response.data.institutions; 

Do you see using the SDK as an alternative?
Please lmk otherwise I can reach out to Plaid support.

@jcortes
Copy link
Collaborator

jcortes commented May 2, 2025

Hi @sergio-eliot-rodriguez yeah I forgot to mention I already tried the SDK but unfortunately it didn't work either. It even seems like it's a bit behind the REST API not sure but it definitely didn't work!

@jcortes jcortes moved this from Prioritized to Doing in Component (Source and Action) Backlog May 6, 2025
@sergio-eliot-rodriguez
Copy link
Collaborator

Currently a workflow to get the an access token via a public token as provided to Jorge for him to continue, while I work on setting up this in this as the auth strategy in the API connector/base integration.

@sergio-eliot-rodriguez
Copy link
Collaborator

I checked, and I found out that it would be complicated to have a setup of only one application in the authentication strategy, because the sandbox itself has different flows depending n the use case (eg. Item Creation vs Income vs Plaid Check Consumer Reports), plus production/development environment require a setup that takes as input a link code obtained via link https://plaid.com/docs/link/

Reaching out to Product check if actually we'd want to update the app, i think we should stick to the SDK.

@sergio-eliot-rodriguez
Copy link
Collaborator

sergio-eliot-rodriguez commented May 7, 2025

Ok I had second thoughts and decided not to approach Product for now, maybe until there is a user actually flagging this.

we would be blocked to change the auth strategy for production for this needs a widget embeded to get a public token (need in turn to get an access token). i could prepare a multie step flow to get access token for sandbox (that doesn't require the widget) but then it would work for sandbox but not for production.

production endpoints require to use link, which documentedly is:

Plaid Link is the client-side component that your users will interact with in order to link their accounts to Plaid and allow you to access their accounts via the Plaid API.

Plaid base integration uses the SDK, which itself depends on the public token returned from Plaid Link

you can verify this from

  1. docs:

Link is supported via SDKs for all modern browsers and platforms, including web, iOS, Android, as well as via React Native, along with community-supported wrappers for Flutter, Angular, and Vue.

  1. SDK's npm package at npmjs:

Examples
...

Exchange a public_token from Plaid Link for a Plaid access_token and then retrieve account data:

const response = await plaidClient.itemPublicTokenExchange({ public_token });
const access_token = response.data.access_token;

Unfortunately this implies as of writting the base integration is broken for production use cases because it expects the public token from Plaid Link which we don't even ask it in the custom fields, is a client side, graphical componentat that we can't use in the submit an app u to incorporate it in the authentication flow strategy. That said, we shouldn't ask for public tokens because theiy are short-lived, with 30 minutes lifetime.

Occasionally, Link itself can enter an error state if the user takes over 30 minutes to complete the Link process

@jcortes jcortes moved this from Doing to Ready for PR Review in Component (Source and Action) Backlog May 7, 2025
@lcaresia lcaresia moved this from Ready for PR Review to Ready for QA in Component (Source and Action) Backlog May 8, 2025
@vunguyenhung vunguyenhung moved this from Ready for QA to In QA in Component (Source and Action) Backlog May 9, 2025
@vunguyenhung vunguyenhung moved this from In QA to Ready for QA in Component (Source and Action) Backlog May 9, 2025
@vunguyenhung vunguyenhung moved this from Ready for QA to In QA in Component (Source and Action) Backlog May 9, 2025
@vunguyenhung vunguyenhung moved this from In QA to Changes Required in Component (Source and Action) Backlog May 9, 2025
@vunguyenhung
Copy link
Collaborator

Hello everyone, I have tested this PR and there're some test cases failed or needed improvement.

Please check the test report below for more information
https://vunguyenhung.notion.site/Components-plaid-1edbf548bb5e81cc9e43c6067fe9f569

@jcortes jcortes moved this from Changes Required to Doing in Component (Source and Action) Backlog May 13, 2025
@jcortes
Copy link
Collaborator

jcortes commented May 13, 2025

Hi @vunguyenhung

Create Sandbox Public Token - Failed

All props - Failed

Seems like an API bug because the only user/password that kind of worked for me are the ones that come with the environment which are user_good/pass_good so I'm removing these props for now

I addressed the rest of issues you mentioned in the document, so please try again with latest push, thanks!

@jcortes jcortes moved this from Doing to Ready for QA in Component (Source and Action) Backlog May 13, 2025
@vunguyenhung vunguyenhung moved this from Ready for QA to In QA in Component (Source and Action) Backlog May 14, 2025
@vunguyenhung vunguyenhung moved this from In QA to Ready for Release in Component (Source and Action) Backlog May 14, 2025
@vunguyenhung
Copy link
Collaborator

Hi everyone, all test cases are passed! Ready for release!

Test report
https://vunguyenhung.notion.site/Components-plaid-1edbf548bb5e81cc9e43c6067fe9f569

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triaged For maintainers: This issue has been triaged by a Pipedream employee
Development

Successfully merging a pull request may close this issue.

4 participants