来自格子文件:
一些机构要求用户从一组有限的答案中回答问题,即多项选择。可能会返回多个问题,并且MFA答案提交必须是JSON编码的数组,其答案的提供顺序与给定的问题相同。
基于此,我理解它意味着:
这是对的吗?
例如,如果格子返回:
{
"type": "questions",
"mfa": [{"question":"What was the name of your first pet?"}],
"access_token": "xxxxx"
}
我会提交:
{
"mfa": "fido"
}
但如果格子图案返回:
{
"type": "questions",
"mfa": [
{"question":"What was the name of your first pet?"},
{"question":"What was the name of your first girlfriend?"}
],
"access_token": "xxxxx"
}
我会提交:
{
"mfa": ["fido", "forever alone"]
}
这是对的吗?
答案 0 :(得分:0)
我相信Plaid一次只会为用户发送一个MFA。我已经检查了他们在沙箱中的一个银行并发送了,然后在我第一次错误地回答了第一个MFA后发送了另一个银行。
我不相信你会在同一个JSON对象中获得2个MFA。
我已经实施了他们的MFA计划:
public static function accountOrMFA($response, $formBuilder, $formId = null, $request = null) {
if ($response) {
// do we have a MFA or the accounts?
if (property_exists($response, "mfa")) {
// we have MFA to deal with
$mfa['type'] = $response->type;
$mfa['data'] = $response->mfa;
$mfa['access_token'] = $response->access_token;
return response()->json(['html' => PlaidController::makeHTMLForMFA($mfa, $formBuilder)]);
} else {
$auth_accounts = [];
$connect_accounts = [];
foreach($response->accounts as $account) {
$auth_accounts[] = [
'id' => $account->_id,
'number' => $account->meta->number,
'name' => $account->meta->name,
'type' => $account->type,
];
}
$connect_response = UserController::storeToken($response, $request); // add this token to the user's tokens
return response()->json(['html' => PlaidController::makeHTMLForAccounts($auth_accounts, $formBuilder, $formId)]);
}
}
return response()->json(['error' => true, 'response' => json_encode($response)]); // maybe the wrong credentials? we don't know
}