title: WP Rest API custom endpoint returning false on GET and POST
body: <p>I have a custom endpoint for User Meta that I've successfully registered to the WP REST API and created a custom endpoint for. However, whenever I make GET and POST requests from my single-page app (JS framework being used is Vue), the return value is 'false.'</p>
  <p>I suspect this is happening due to some authorization issues using the JWT Authorization for WP REST API plugin.</p>
  <p>Here are my steps taken in the functions.php app:</p>
  <p>First I register the user meta field for the REST API:</p>
  <pre><code>
  //register user meta to rest api 
  add_action( 'rest_api_init', 'adding_user_meta_rest' );
  
  function adding_user_meta_rest (){
      register_meta(
       'user',
       'user_likes',
       array(
           'single'       =&gt; false,
           'type'         =&gt; 'object',
           'show_in_rest' =&gt; true,
       )
   );
  };
  </code></pre>
  <p>This step appears to be working fine since the field is showing up when I use the path &quot;/wp-json/wp/v2/users/&quot;.</p>
  <p>Next step, I register the custom end point:</p>
  <pre><code>add_action('rest_api_init','add_user_likes');
  
  function add_user_likes(){
      register_rest_route(
      'v1/user_likes','/(?P&lt;id&gt;\d+)',[[
          'methods'=&gt; 'GET',
          'callback'=&gt;'get_user_likes'
      ],
      [
          'methods'=&gt; 'POST',
          'callback'=&gt;'post_user_likes'
      ]]);
  };
  
  </code></pre>
  <p>And here are my callbacks:</p>
  <pre><code>function get_user_likes(){
      $current_user_id = get_current_user_id();
      $status = $response-&gt;get_status;
      return get_user_meta($current_user_id,'user_likes');
  }
  </code></pre>
  <pre><code>function post_user_likes(WP_REST_Request $req){
      $body = $req-&gt;get_json_params();
      $current_user_id = get_current_user_id();
      return update_user_meta($current_user_id, 'user_likes',$body);
  };
  </code></pre>
  <p>And then on the front end, here is my POST request:</p>
  <pre><code>handleLike(){
        fetch(`https://site-url.com/wp-json/v1/user_likes/${this.$store.state.userInfo.id}`,{
          method:&quot;POST&quot;,
          body:JSON.stringify({
            post_id:this.currentPost.id,
            post_title:this.currentPost.title.rendered
          }),
           headers: {
            &quot;Content-Type&quot;: &quot;application/json&quot;,
            &quot;Authorization&quot;: `Bearer ${this.$store.state.accessToken}`
          },
        }).then(resp=&gt;resp.json())
        .then(data=&gt;console.log(data)) 
  
  </code></pre>
  <p>My GET request is also returning false.</p>
  <p>The issue I believe is that I am not retrieving the current user ID because according to docs for get_user_meta and update_user_meta, if user id is not determined, the function will return false. Why the user id is not being determined, I don't know.
  As I mentioned, I am using the JWT Authorization for WP REST API. Therefore based on my reading, I do not need to generate a nonce because WP will use the token to determine the current user. Let me know if I am wrong about that.
  Any guidance would be greatly appreciate.</p>