I'm trying to get a scraper working where two factor authentication (Duo) is in place. Everytime I send a POST to attempt the authentication, it fails with a 400 (Bad Request). Here's the latest version of the code I've tried:
use Goutte\Client;
$client = new Client();
$res = $client->request('POST', 'https://example.com/cosign.cgi', [
'body' => 'login=theuser&password=thepassword&service=theservice&passcode=8675309',
]);
The body of the error page that's returned says that cookies need to be enabled. Yet, cookies are enabled in $client.
"https://example.com/cosign.cgi" - is probably a wrapper on top of DSA (CoSign) APIs. Please reveal the code behind. Regarding on how to use 2-factor authentication when signin: for complete information on DSA APIs refer to DSA Programmer Guide and to DSA Developer Center. RESTFull API was introduced in DSA v8.2+. Here is an example:
Insert the password to login to the DSA signer account in the basic authorization header. Insert the OTP in the body "signPassword" field.
Replace the cosign placeholder in https://cosign:8081/sapiws/v1/digital_signature with your properly exposed appliance DNS.