• Resolved stoi2m1

    (@stoi2m1)


    I have made a couple of custom endpoints within my API and I am looking for a way to implement the use of your plugin with it.

    This is what I have tried so far from within my response function for one of my end points.

    var_dump(wp_get_current_user());
    die();

    The results are a user object with ID = 0;

    From what I can tell from looking through the plugin code I should be able to use the function wp_get_current_user() since the filter used within this plugin to load the current user is within that wordpress function. However, when I attempt to use that function I get an empty user object.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author michielve

    (@michielve)

    Hi,

    You should be able to use all WP functions.

    Just to be sure: did you login, got the access token and sent it to the custom endpoint?

    BW,
    Michiel

    Thread Starter stoi2m1

    (@stoi2m1)

    I was positive I was sending the access token in the header. I started things over and am now only getting results when I am logged in and have good user object from wp_get_current_user().

    I ended up reworking a lot of my logic and things are working just fine. I then wanted to get partial data from the backend when a user was not logged in. So, I whitelisted the endpoint and used is_user_logged_in() to hide data I don’t want sent out.

    I don’t know where my confusion came from, but all is good.

    Thanks for the great plugin.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Protecting Custom End Points’ is closed to new replies.