#42715 closed defect (bug) (worksforme)
Incorrect results for http://demo.wp-api.org/wp-json/wp/v2/users/me endpoint
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.9 |
Component: | REST API | Keywords: | |
Focuses: | Cc: |
Description
I'm encountering inconsistent data returned from /wp-json/wp/v2/users/me endpoint when calling the end point. The get_current_user_id() always return 0, even though I am already logged in.
Well after doing login, apply_filters( 'determine_current_user', false ) returning correct user ID but get_current_user_id() gives 0. I am doing login using rest api with Basic Auth plugin.
Change History (2)
Note: See
TracTickets for help on using
tickets.
Hey @kishores,
This is working fine for me, and looking at the linked discussion, it sounds like you're not properly authenticated to the API - maybe because the Authentication plugin you're using isn't fully compatible.
As this is working fine for me in core, using the cookie/nonce authentication (which you should try to get working first) I'm going to assume that it's likely the plugin is at fault, in which case reporting the issue to https://github.com/WP-API/Basic-Auth is your best method (It looks like lots of people have issues with the plugin)