1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52:
<?php
namespace Comprobo\Verify\Auth;
use Comprobo\Verify\Exceptions;
use Comprobo\Verify\Factory;
class Server
{
private $factory;
private $config;
public function __construct(Factory $factory)
{
$this->factory = $factory;
$this->config = $factory->getConfig();
}
public function authenticate($key, $secret)
{
$params = [
'key' => $key,
'secret' => $secret
];
$request = $this->factory->getRequest();
$response = $request->post($this->config['urls']['auth'], ['json' => $params]);
$body = json_decode((string) $response->getBody(), true);
return $body;
}
}