Skip to content

Commit d77da3f

Browse files
authored
Merge pull request #64 from wp-graphql/bug/#45-tokens-identical-for-non-admins
#45 - auth and refresh token are same for non-admins
2 parents 0ad0481 + 61f26fb commit d77da3f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Auth.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,10 @@ public static function get_user_jwt_secret( $user_id ) {
216216
$capability = apply_filters( 'graphql_jwt_auth_edit_users_capability', 'edit_users', $user_id );
217217

218218
/**
219-
* If the request is not from the current_user or the current_user doesn't have the proper capabilities, don't return the secret
219+
* If the request is not from the current_user AND the current_user doesn't have the proper capabilities, don't return the secret
220220
*/
221221
$is_current_user = ( $user_id === get_current_user_id() ) ? true : false;
222-
if ( ! $is_current_user || ! current_user_can( $capability ) ) {
222+
if ( ! $is_current_user && ! current_user_can( $capability ) ) {
223223
return new \WP_Error( 'graphql-jwt-improper-capabilities', __( 'The JWT Auth secret for this user cannot be returned', 'wp-graphql-jwt-authentication' ) );
224224
}
225225

0 commit comments

Comments
 (0)