File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -297,14 +297,16 @@ public static function get_token( $user, $cap_check = true ) {
297297
298298 public static function get_refresh_token ( $ user , $ cap_check = true ) {
299299
300+ self ::$ is_refresh_token = true ;
301+
300302 /**
301303 * Filter the token signature for refresh tokens, adding the user_secret to the signature and making the
302304 * expiration long lived so that the token can be used for a long time without the client having to store a new
303305 * one.
304306 */
305307 add_filter ( 'graphql_jwt_auth_token_before_sign ' , function ( $ token , \WP_User $ user ) {
306308 $ secret = Auth::get_user_jwt_secret ( $ user ->ID );
307- if ( ! empty ( $ secret ) && ! is_wp_error ( $ secret ) ) {
309+ if ( ! empty ( $ secret ) && ! is_wp_error ( $ secret ) && true === self :: is_refresh_token () ) {
308310
309311 /**
310312 * Set the expiration date as a year from now to make the refresh token long lived, allowing the
@@ -313,6 +315,9 @@ public static function get_refresh_token( $user, $cap_check = true ) {
313315 */
314316 $ token ['exp ' ] = apply_filters ( 'graphql_jwt_auth_refresh_token_expiration ' , ( self ::get_token_issued () + ( DAY_IN_SECONDS * 365 ) ) );
315317 $ token ['data ' ]['user ' ]['user_secret ' ] = $ secret ;
318+
319+ self ::$ is_refresh_token = false ;
320+
316321 }
317322
318323 return $ token ;
You can’t perform that action at this time.
0 commit comments