REST error: Not logged error is showing when logged in.

Support MB REST API REST error: Not logged error is showing when logged in.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #37531
    JasonJason
    Participant

    I am working on a private portal site for a client and am having issues with getting some data via the REST API.

    When try to view the API when not logged in (https://portal.local/wp-json/wp/v2/voyage/198), I see this:

    {"code":"rest_not_logged_in","message":"You are not currently logged in.","data":{"status":401}}

    When I'm logged in, I can see the data, so that part is working.

    It seems like it's the way I am trying to get the data. When I do a var_dump of the response, I am seeing "not logged in" error:
    {"code":"rest_not_logged_in","message":"You are not currently logged in.","data":{"status":401}}

    Here is my code in pastebin.com: https://pastebin.com/GdDVkzmj

    #37544
    Long NguyenLong Nguyen
    Moderator

    Hi Jason,

    If you want to get the data via REST API by using a WP function, please add the authentication parameter to the header of the request. Please refer to this topic https://stackoverflow.com/questions/33990046/wp-remote-get-not-passing-authentication

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.