public function verifyAccessToken($accessToken)
    {
        $jwtPayload = $this->decodeAccessToken($accessToken);

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

        if ($jwtPayload['token_use'] !== 'access') {
            throw new TokenVerificationException('invalid token_use');
        }

        if ($jwtPayload['exp'] < time()) {
            throw new TokenExpiryException('invalid exp');
        }

        return $jwtPayload['username'];
    }
public function verifyAccessToken($accessToken)
    {
        $jwtPayload = $this->decodeAccessToken($accessToken);

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

        if ($jwtPayload['token_use'] !== 'access') {
            throw new TokenVerificationException('invalid token_use');
        }

        if ($jwtPayload['exp'] < time()) {
            throw new TokenExpiryException('invalid exp');
        }

        return $jwtPayload['username'];
    }
public function verifyAccessToken ( $ accessToken ) { $ jwtPayload = $ this -> decodeAccessToken ( $ accessToken ) ; $ expectedIss = sprintf ( 'https://cognito-idp.%s.amazonaws.com/%s' , $ this -> region , $ this -> userPoolId ) ; if ( $ jwtPayload [ 'iss' ] !== $ expectedIss ) { throw new TokenVerificationException ( 'invalid iss' ) ; } if ( $ jwtPayload [ 'token_use' ] !== 'access' ) { throw new TokenVerificationException ( 'invalid token_use' ) ; } if ( $ jwtPayload [ 'exp' ] < time ( ) ) { throw new TokenExpiryException ( 'invalid exp' ) ; } return $ jwtPayload [ 'username' ] ; }
Verifies the given access token and returns the username

@param string $accessToken

@throws TokenExpiryException
@throws TokenVerificationException

@return string
Verifies the given access token and returns the username