• Resolved 21stcn

    (@21stcn)


    First thing

    1. On the documentation page, https://wp-oauth.com/docs/general/wp-rest-api-authentication/, when I click support request, it links to https://wp-oauth.com/account/my-tickets/ which is a 404, “Well this is embarrassing ;( — 404 Error We can not find what you are looking for.”

    I have bought the plugin. What is the best place to find support? Is it here in wordpress plugin support, via the ‘LiveChat’ on the docs site, or is there a place I can open a support ticket?

    2. Bearer token issue

    I am unable to successfully use the bearer token header to make an authenticated request to the WP REST API.

    For example, the url:
    https://blog.londolozi.com/wp-json/wp/v2/posts/86069/revisions

    I have a valid admin user access token.

    If I access the url with the parameter ?access_token={the_token}, I can access this endpoint without a problem.

    If however I make a request using the Bearer header and the same token, I get “Sorry, you are not allowed to view revisions of this post”, “data”:{“status”:401}

    This is what I am using (php curl), just so you can check but I think it should work correctly as it works fine with sending the Basic: client_id:client_secret headers.

    
    $url = 'https://blog.londolozi.com/wp-json/wp/v2/posts/86069/revisions';
    $token = valid_admin_token;
    
    $headers = [
        'Bearer: '.$token,
        'Content-Type: application/x-www-form-urlencoded'
    ];
    
    $ch = curl_init();
    
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    
    $data = curl_exec($ch);
    curl_close($ch);
    

    So I am setting the Bearer http header to a valid admin token, and then removing the query parameter ?access_token=the_token, so that the token is passed in the http headers instead, and not as a url parameter (which is the point of bearer header, I believe), however I am getting denied access.

    Is there something I am missing or misunderstanding? The documentation is not very comprehensive on this. Thanks so much

    • This topic was modified 5 years, 7 months ago by 21stcn.
    • This topic was modified 5 years, 7 months ago by 21stcn.
    • This topic was modified 5 years, 7 months ago by 21stcn.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Issues with Bearer Token’ is closed to new replies.