'AWS signature in shilogic API
I'm implementing shiplogic's API into my program and have never worked with AWS authentication
<?PHP
$host = "api.shiplogic.com";
$accessKey = 'AKIA55D5DNTBFC3I7BHQ';
$secretKey = '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';
$requestUrl = 'https://api.shiplogic.com';
$uri = '/rates';
$httpRequestMethod = 'POST';
require 'vendor/autoload.php';
use Aws\Signature\SignatureV4;
use Aws\Credentials\Credentials;
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Request;
use Psr\Http\Client\ClientInterface;
$signature = new SignatureV4('execute-api', 'af-south-1');
$credentials = new Credentials($accessKeyId, $secretAccessKey);
$Request = new Request($httpRequestMethod, $requestUrl.$uri, ["content-
type"=>"application/json"], $data);
$sr = $signature->signRequest($Request, $credentials);
//var_dump($response); ?>
Now it's a simple piece of code but I'm constantly getting a 403 response. Am I sending the correct Psr7\request for Authorization? Please assist.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
