Tuesday, August 16, 2022
HomeWordPress DevelopmentWP relaxation api endpoint safety utilizing jwt token

WP relaxation api endpoint safety utilizing jwt token


I’ve been attempting to validate jwt token inside theme operate.php file. i’m not positive tips on how to move this jwt token validate inside this hook operate. the next operate is working with out authorization header additionally i want to guard the endpoint utilizing jwt authorization with out this it ought to throw a error. lot of instance displaying javascript primarily based operate to fetch the main points.

add_action( 'rest_api_init', operate ($information) {
    register_rest_route( 'jwt-auth/v1', 'sci', array(
       'strategies' => 'POST', 
        'callback' => 'update_payment_history',
        'permission_callback' => '__return_true' 
    ) );  
    
  /*  register_rest_route( 'v1', 'certificates', array(
       'strategies' => 'POST', 
        'callback' => 'update_payment_history',
        'permission_callback' => '__return_true' 
    ) ); */
    
    
    register_rest_route( 'jwt-auth', 'v1/token', array(
       'strategies' => 'POST', 
        'callback' => 'gettoken',
        'permission_callback' => '__return_true' 
    ) );
    
    
  
    
    
    
} );

operate update_payment_history(WP_REST_Request $request) {
print_r( $request->get_param('transaction_id'));
 exit;
}

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments