• Resolved jdoersel

    (@jdoersel)


    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! ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Nicu Micle

    (@nicu_m)

    Hello @jdoersel,

    Thank you for the heads up. I have this bug on my board, but I’ve forgotten to prioritize it.

    I will make a release this weekend and I will come back with updates.

    PS: Please don’t forget to rate this plugin.

    Best regards,
    Nicu.

    Plugin Author Nicu Micle

    (@nicu_m)

    Hello @jdoersel,

    I’ve just released version 2.5.2 and the fix is included.

    PS: Please let me know if it’s working ok for you.

    Best regards,
    Nicu.

    Thread Starter jdoersel

    (@jdoersel)

    Thank you, everything is fine after update.
    Version 2.5.2 tested on WordPress 5.5.3

    Best regards,
    John.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Missing ‘permission_callback’’ is closed to new replies.