Skip to content

Commit 3c4f400

Browse files
authored
Merge pull request #1 from InternationalCodeCouncil/exceptions
Exceptions
2 parents e23b33f + 497d6f7 commit 3c4f400

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/CognitoClient.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -512,15 +512,15 @@ public function verifyAccessToken($accessToken)
512512

513513
$expectedIss = sprintf('https://cognito-idp.%s.amazonaws.com/%s', $this->region, $this->userPoolId);
514514
if ($jwtPayload['iss'] !== $expectedIss) {
515-
throw new TokenVerificationException('invalid iss');
515+
throw new TokenVerificationException('Invalid token issuer');
516516
}
517517

518518
if ( !in_array($jwtPayload['token_use'], ['id','access']) ) {
519-
throw new TokenVerificationException('invalid token_use');
519+
throw new TokenVerificationException('Invalid token purpose/use');
520520
}
521521

522522
if ($jwtPayload['exp'] < time()) {
523-
throw new TokenExpiryException('invalid exp');
523+
throw new TokenExpiryException('Expired token');
524524
}
525525

526526
return $jwtPayload['username'] ?? $jwtPayload['cognito:username'];

src/Exception/ExipredCodeException.php

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
namespace pmill\AwsCognito\Exception;
3+
4+
class ExpiredCodeException extends CognitoResponseException
5+
{
6+
}

0 commit comments

Comments
 (0)