based on Documentation I've tried to make GET request. When I make GET request through the POSTMAN app, it works fine and it returns me proper respond, but when I try to make the same call through php(Laravel) I get 401 error code.
my code for basic Auth looks like this:
namespace App;
use GuzzleHttp\Client;
class Api extends Model
{
static function TiktalikRespond(){
$client = new Client();
$base_encode = base64_encode(username:password);
$res = $client->get(
'https://www.tiktalik.com/api/v1/computing/instance',
['headers' => ['Authorization' => 'Basic '.$base_encode]]
);
$respond = $res->getBody();
return json_decode($respond);
}
}
my code for API key looks like this:
namespace App;
use GuzzleHttp\Client;
class Api extends Model
{
static function TiktalikRespond2(){
$client = new Client();
$sha1 = hash_hmac('sha1',
'GET \n \n application\json \n X-TK-Date \n https://www.tiktalik.com/api/v1/computing/instance',
'private_api_key');
$res = $client->get(
'https://www.tiktalik.com/api/v1/computing/instance',
['headers' => ['Authorization' => 'TKAuth API_KEY:'.$sha1]]
);
$respond = $res->getBody();
return json_decode($respond);
}
}
I need a fresh look maybe I've done something wrong :)
PS. API Auth doesn't work for both cases, PHP and POSTMAN, I'm guessing that I messed up something with SHA1 value :)