Skip to content

Commit adb4f8f

Browse files
committed
#26 - Expose Refresh Token in Authenticated REST API requests
- code review updates
1 parent fc107b8 commit adb4f8f

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

src/ManageTokens.php

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -293,17 +293,11 @@ public static function use_custom_user_expiration( $expiration ) {
293293
*/
294294
public static function add_tokens_to_graphql_response_headers( $headers ) {
295295

296-
$should_return_tokens = false;
297-
298296
/**
299297
* If the request _is_ SSL, or GRAPHQL_DEBUG is defined, return the tokens
300298
* otherwise do not return them.
301299
*/
302-
if ( is_ssl() || defined( 'GRAPHQL_DEBUG' ) && true !== GRAPHQL_DEBUG ) {
303-
$should_return_tokens = true;
304-
}
305-
306-
if ( ! $should_return_tokens ) {
300+
if ( ! is_ssl() && ( ! defined( 'GRAPHQL_DEBUG' ) || true !== GRAPHQL_DEBUG ) ) {
307301
return $headers;
308302
}
309303

@@ -358,17 +352,11 @@ public static function add_tokens_to_graphql_response_headers( $headers ) {
358352
*/
359353
public static function add_auth_headers_to_rest_response( \WP_HTTP_Response $response, $handler, $request ) {
360354

361-
$should_return_tokens = false;
362-
363355
/**
364356
* If the request _is_ SSL, or GRAPHQL_DEBUG is defined, return the tokens
365357
* otherwise do not return them.
366358
*/
367-
if ( is_ssl() || defined( 'GRAPHQL_DEBUG' ) && true !== GRAPHQL_DEBUG ) {
368-
$should_return_tokens = true;
369-
}
370-
371-
if ( ! $should_return_tokens ) {
359+
if ( ! is_ssl() && ( ! defined( 'GRAPHQL_DEBUG' ) || true !== GRAPHQL_DEBUG ) ) {
372360
return $response;
373361
}
374362

0 commit comments

Comments
 (0)