true, 'ExpiredTokenException' => true, 'ExpiredToken' => true ); /** * @var ExceptionParserInterface Exception parser used to parse exception responses */ protected $exceptionParser; public function __construct(ExceptionParserInterface $exceptionParser, BackoffStrategyInterface $next = null) { $this->exceptionParser = $exceptionParser; $this->next = $next; } public function makesDecision() { return true; } protected function getDelay($retries, RequestInterface $request, Response $response = null, HttpException $e = null) { if ($response && $response->isClientError()) { $parts = $this->exceptionParser->parse($request, $response); if (!isset($this->retryable[$parts['code']]) || !$request->getClient()) { return null; } /** @var $client AwsClientInterface */ $client = $request->getClient(); // Only retry if the credentials can be refreshed if (!($client->getCredentials() instanceof AbstractRefreshableCredentials)) { return null; } // Resign the request using new credentials $client->getSignature()->signRequest($request, $client->getCredentials()->setExpiration(-1)); // Retry immediately with no delay return 0; } } }