File tree Expand file tree Collapse file tree 1 file changed +3
-12
lines changed Expand file tree Collapse file tree 1 file changed +3
-12
lines changed Original file line number Diff line number Diff line change @@ -198,16 +198,8 @@ function init() {
198198
199199add_action ( 'plugins_loaded ' , '\WPGraphQL\JWT_Auth\init ' , 1 );
200200
201- add_filter ( 'determine_current_user ' , function ( $ user ) {
202201
203- /**
204- * Bail if it's not a GraphQL HTTP Request
205- *
206- * @todo: consider supporting REST too?
207- */
208- if ( ! defined ( 'GRAPHQL_HTTP_REQUEST ' ) || false === GRAPHQL_HTTP_REQUEST ) {
209- return $ user ;
210- }
202+ add_filter ( 'determine_current_user ' , function ( $ user ) {
211203
212204 /**
213205 * Validate the token, which will check the Headers to see if Authentication headers were sent
@@ -219,7 +211,7 @@ function init() {
219211 /**
220212 * If no token was generated, return the existing value for the $user
221213 */
222- if ( empty ( $ token ) ) {
214+ if ( empty ( $ token ) || is_wp_error ( $ token ) ) {
223215
224216 /**
225217 * Return the user that was passed in to the filter
@@ -239,9 +231,8 @@ function init() {
239231
240232 }
241233
242-
243234 /**
244235 * Everything is ok, return the user ID stored in the token
245236 */
246237 return absint ( $ user );
247- } );
238+ }, 99 , 1 );
You can’t perform that action at this time.
0 commit comments