使用 Plaid Link 显示自定义用户名和密码模式对话框

Display custom user name and password modal dialog with Plaid Link

我正在使用 Plaid Link 及其 custom integration,到目前为止我能够提取机构列表。这很棒,因为我不必对机构列表进行硬编码,而且我可以显示用于选择机构的自定义模式对话框。

现在下一步是让用户输入他们的凭据,以便我通过 onSuccess 回调获得 public_tokenmetadata。 Plaid Link 要我用传入的所选机构类型调用 linkHandler.open,这将显示 Plaid 模态对话框,允许用户输入其凭据并确认。然后调用 onSuccess 回调。

但是如果我想让用户通过自定义模式输入他们的用户名和密码怎么办。是否有类似 linkHandler.auth(userName, password) 的东西会导致 onSuccess 以类似的方式被调用,但如果不显示模态对话框我就无法设置样式?

这是代码片段,但它基本上是从文档中复制粘贴的,所以这并不奇怪:

let plaidLink = Plaid.create({
  env: "tartan",
  clientName: "",
  key: "blahblahblah", // A correct public key.
  product: "auth",
  onLoad: () => {
    console.debug("onLoad");
  },
  onSuccess: (publicToken, metadata) => {
    console.debug("onSuccess");
  },
  onExit: () => {
    console.debug("onExit");
  }
});

// Don't want this!
//plaidLink.open("bofa"); 

// Want this, this is cool, but can I get the same for the credential dialog?
console.debug("institutions", plaidLink.institutions);

恐怕您正在寻找的功能目前在 Plaid Link 中不存在,并且很可能在不久的将来不会实现。这是因为 Link 是专门为处理每家银行所拥有的相当复杂的流程和可能性范围而构建的。

对于像 Wells Fargo 这样不需要 MFA 问题或答案的简单集成,您的提议可能会奏效。

Plaid.auth('wells', userName, password)

但是对于ChaseBank of America这样的其他机构,它们都有各种各样的MFA问题,流程会复杂得多,不可能通过一次方法调用。

Plaid.auth('chase', userName, password)
Plaid.mfaDevice('chase', device)
Plaid.mfaCode('chase', code)
Plaid.handleMfaError('chase', error)
// ...

如果您确实想向用户显示自定义模式,您可以选择构建自己的 Plaid 实现 API。 Plaid Link 但是可以为您处理所有这些复杂性,我强烈建议您使用它来确保您的用户拥有良好的用户体验。 Plaid 团队积极维护 Link,因此不断改进​​,并经常发布新功能。