php - GetSessionToken command not found in AWS SDK -
i have following code
<?php require '../aws/aws-autoloader.php'; use aws\sts\stsclient; use aws\s3\s3client; $sts = s3client::factory(array( 'key' => 'key', 'secret' => 'key', )); $result = $sts->getsessiontoken(); $credentials = $result->get('credentials'); print_r($credentials); ?>
however, it's resulting in error:
uncaught exception 'guzzle\common\exception\invalidargumentexception' message 'command not found matching getsessiontoken' in /home/site/public_html/dev/testaws/core/aws/guzzle/service/client.php:87 stack trace: #0 /home/site/public_html/dev/testaws/core/aws/guzzle/service/client.php(76): guzzle\service\client->getcommand('getsessiontoken', array) #1 /home/site/public_html/dev/testaws/core/aws/aws/common/client/abstractclient.php(105): guzzle\service\client->__call('getsessiontoken', array) #2 /home/site/public_html/dev/testaws/core/ajax/test2.php(13): aws\common\client\abstractclient->__call('getsessiontoken', array) #3 /home/site/public_html/dev/testaws/core/ajax/test2.php(13): aws\s3\s3client->getsessiontoken() #4 {main} thrown in /home/site/public_html/dev/testaws/core/aws/guzzle/service/client.php on line 87
the issue line:
$result = $sts->getsessiontoken();
i've been following guide: http://docs.aws.amazon.com/amazons3/latest/dev/authusingtempsessiontokenphp.html
i don't see reason error occurring. there reason this, or way fix it?
you mixing example up. s3client::factory() expects token param. maybe should using stsclient::factory()?
Comments
Post a Comment