Missing ‘permission_callback’
-
Hi,
Sorry if this is not the right place, but I can’t figure out where to post a bug report for the simple-jwt-login. If it’s not the right place, could anyone tell me where to post it. Thanks!I’ve updated my website to PHP 7.4 with the latest version of wordpress (5.5.3)
and when simple-jwt-login plugin is activated, there are several notices about a missing ‘permission_callback’ for each and every of the simple-jwt-plugin services endpoints.I’ve corrected it myself for my website, so there is no emergency for me (until next update)
Here is how I’ve solved the issue:
In “routes.php, at line 102, I’ve added the following code in the 3rd argument (array) of the register_rest_route function call done for all the $availableRoutes:
'permission_callback' => true
Long story short, it gives this:
foreach ( $availableRoutes as $route ) { register_rest_route( rtrim($jwtSettings->getRouteNamespace(),'/\\'), $route['name'], [ 'methods' => $route['method'], 'callback' => function ( $request ) use ( $route, $routeService, $jwtService, $jwtSettings ) { /*** * @var $request WP_REST_Request */ try { $jwtService->withRequest( $request->get_params() ); $routeService->withService( $jwtService ); return $routeService->makeAction( $route['name'], $route['method'] ); } catch ( Exception $e ) { @header( 'Content-Type: application/json; charset=UTF-8' ); wp_send_json_error( [ 'message' => $e->getMessage(), 'errorCode' => $e->getCode() ], 400 ); return false; } }, 'permission_callback' => true ] ); } } );
Best regards,
John.P.S.: Great work by the way. This plugin helped me a lot automating tasks. Thanks! ??
- The topic ‘Missing ‘permission_callback’’ is closed to new replies.