· 6 years ago · Jun 29, 2019, 10:56 PM
1'Content-type': 'application/json',
2'Authorization': 'Bearer token_value'
3
4function get_loggedin_user_info(){
5 global $current_user;
6
7 $current_user = wp_get_current_user();
8 print_r($current_user);
9}
10
11add_action( 'rest_api_init', function () {
12 register_rest_route( 'endpoints/v1', '/logininfo', array(
13 'methods' => 'POST',
14 'callback' => 'get_loggedin_user_info'
15 ));
16});
17
18define('JWT_AUTH_SECRET_KEY', 'secret-key');
19define('JWT_AUTH_CORS_ENABLE', true);