Skip to content

Commit f86c679

Browse files
Fix incorrect error message on invalid secret
If a token with an invalid secret key is passed, the error returned will be `The iss do not match with this server` when the `iss` field is set correctly. This PR fixes that.
1 parent 6f4c18a commit f86c679

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Auth.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ public static function validate_token( $token = null, $refresh = false ) {
571571
try {
572572
$token = ! empty( $token ) ? JWT::decode( $token, $secret, [ 'HS256' ] ) : null;
573573
} catch ( \Exception $exception ) {
574-
$token = new \WP_Error( 'invalid-secret-key', $exception->getMessage() );
574+
return new \WP_Error( 'invalid-secret-key', $exception->getMessage() );
575575
}
576576

577577
/**

0 commit comments

Comments
 (0)