Php 带双因素认证的痛风刮除(duo)

Php 带双因素认证的痛风刮除(duo),php,cookies,guzzle,goutte,cosign-api,Php,Cookies,Guzzle,Goutte,Cosign Api,我正试图让一个刮板在双因素认证(Duo)的地方工作。每次我发送一个帖子来尝试身份验证时,它都会失败,请求错误。以下是我尝试过的代码的最新版本: use Goutte\Client; $client = new Client(); $res = $client->request('POST', 'https://example.com/cosign.cgi', [ 'body' => 'login=theuser&password=the

我正试图让一个刮板在双因素认证(Duo)的地方工作。每次我发送一个帖子来尝试身份验证时,它都会失败,请求错误。以下是我尝试过的代码的最新版本:

    use Goutte\Client;

    $client = new Client();

    $res = $client->request('POST', 'https://example.com/cosign.cgi', [
      'body' => 'login=theuser&password=thepassword&service=theservice&passcode=8675309',
  ]);
返回的错误页面主体表示需要启用Cookie。然而,cookie是在$client中启用的

“”-可能是DSA(CoSign)API之上的包装器。请透露背后的代码。关于如何在登录时使用双因素身份验证:有关DSA API的完整信息,请参阅和。RESTFull API是在DSA v8.2+中引入的。以下是一个例子:

<?php
$request = new HttpRequest();
$request->setUrl('https://cosign:8081/sapiws/v1/digital_signature');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders(array('postman-token' => 'c37705a2-4e8a-eb47-fcbe-62568507717b',
                           'cache-control' => 'no-cache',
                           'content-type' => 'application/json',
                           'authorization' => 'Basic YXZpdjoxMjM0NTY3OEFi'));
$request->setBody('{ "signField" :  {"file":"BASE64PDFContent",
                                     "FileType": "PDF",
                                     "signPassword": "password",
                                     "signPasswordType": "STRING"
                                    }
                   }');
try {
      $response = $request->send();
      echo $response->getBody();
   } 
   catch (HttpException $ex) {
   echo $ex;
}