Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve #144 & avoid misusing Refresh-token as Auth-token for Authorisation #145

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,14 @@ public static function validate_token( $token = null, $refresh = false ) {
if ( Auth::is_jwt_secret_revoked( $token->data->user->id ) ) {
return new \WP_Error( 'invalid-jwt', __( 'The User Secret does not match or has been revoked for this user', 'wp-graphql-jwt-authentication' ) );
}

/**
* Check if the refresh token is not provided as auth token
*/
if ( $refresh === false ) {
return new \WP_Error( 'invalid-jwt', __( 'Refresh token is not allowd as auth token!', 'wp-graphql-jwt-authentication' ) );
}

}

if ( is_wp_error( $token ) ) {
Expand Down
4 changes: 2 additions & 2 deletions wp-graphql-jwt-authentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Author URI: https://www.wpgraphql.com
* Text Domain: wp-graphql-jwt-authentication-jwt-authentication
* Domain Path: /languages
* Version: 0.4.0
* Version: 0.4.1
* Requires at least: 4.7.0
* Tested up to: 4.8.3
* Requires PHP: 5.5
Expand Down Expand Up @@ -113,7 +113,7 @@ public function __wakeup() {
private function setup_constants() {
// Plugin version.
if ( ! defined( 'WPGRAPHQL_JWT_AUTHENTICATION_VERSION' ) ) {
define( 'WPGRAPHQL_JWT_AUTHENTICATION_VERSION', '0.4.0' );
define( 'WPGRAPHQL_JWT_AUTHENTICATION_VERSION', '0.4.1' );
}

// Plugin Folder Path.
Expand Down