Połączenie z API AWS

0

Cześć,
Próbuję się połączyć z API AWS, niestety wyświetla mi dziwny błąd i utknąłem :( Gorąca prośba o pomoc, może ktoś spotkał się już z tym.


<?php
   require 'vendor/autoload.php';

    use Aws\Rekognition\RekognitionClient;


    $client = new Aws\Rekognition\RekognitionClient([
        'version' => 'latest',
        'region' => 'eu-west-1',
        'credentials' => [
            'key' => 'key',
            'secret' => 'secret key',
        ]
    ]);

    $result = $client->detectLabels([
        'Image' => [
            'Bytes' => file_get_contents('auto.jpg'),
        ],
        'MaxLabels' => 30,
        'MinConfidence' => 20,
    ]);

    print_r($result) 
?>

Wyrzuca dwa dziwne błędy z moimi kluczami:

Poniżej w kodzie błędu zmieniłem moje klucze:
yyyyyyyyyyyyyyy - to mój key
xxxxxxxxxxxxxxx - to mój secreet key


Fatal error: Uncaught exception 'Aws\Rekognition\Exception\RekognitionException' with message 'Error executing "DetectLabels" on "https://rekognition.eu-west-1.amazonaws.com"; AWS HTTP error: Client error: `POST https://rekognition.eu-west-1.amazonaws.com` resulted in a `400 Bad Request` response: {"__type":"IncompleteSignatureException","message":"'xxxxxxxxxxxxxxxxxxxxxxxxxxx/20200322/eu-west-1/rekogni (truncated...) IncompleteSignatureException (client): 'xxxxxxxxxxxxxxxxxxxxxxxxx/20200322/eu-west-1/rekognition/aws4_request' not a valid key=value pair (missing equal-sign) in C:\wamp64\www\aws\vendor\aws\aws-sdk-php\src\WrappedHttpHandler.php on line 195


Aws\Rekognition\Exception\RekognitionException: Error executing "DetectLabels" on "https://rekognition.eu-west-1.amazonaws.com"; AWS HTTP error: Client error: `POST https://rekognition.eu-west-1.amazonaws.com` resulted in a `400 Bad Request` response: {"__type":"IncompleteSignatureException","message":"'xxxxxxxxxxxxxxxxxxxxxxxx/20200322/eu-west-1/rekogni (truncated...) IncompleteSignatureException (client): 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/20200322/eu-west-1/rekognition/aws4_request' not a valid key=value pair (missing equal-sign) in Authorization header: 'AWS4-HMAC-SHA256 Credential=yyyyyyyyyyyyyyyyyyyyyyy,xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/20200322/eu-west-1/rekognition/aws4_request, SignedHeaders=host;x-amz-date;x-amz-target, Signature=acb5a32305314059a503c9fb0e8327ce3e1a5f8bda38fee680215a821afbd8b7'. - {"__type":"IncompleteSignatureException","message":"'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/20200322/eu-west-1/rekognition/aws4_request' not a valid key=value pair (missing equal-sign) in Authorization header: 'AWS4-HMAC-SHA256 Credential=yyyyyyyyyyyyyyyyyyyy,xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/20200322/eu-west-1/rekognition/aws4_request, SignedHeaders=host;x-amz-date;x-amz-target, Signature=acb5a32305314059a503c9fb0e8327ce3e1a5f8bda38fee680215a821afbd8b7'."} in C:\wamp64\www\aws\vendor\aws\aws-sdk-php\src\WrappedHttpHandler.php on line 195

0

Pierwszy wynik z google już wystarczająco naprowadza, ale lepiej żeby ktoś poszukał za Ciebie prawda? https://forums.aws.amazon.com/thread.jspa?threadID=254846

1 użytkowników online, w tym zalogowanych: 0, gości: 1