In a custom REST API method, I would like to identify the user (typically get_current_user_id()
then retrieve their data from database (things like they're role and some custom permission).
But so far get_current_user_id()
returns 0 (which is not the current user ID).
Is it possible to identify user in REST API?
Otherwise, a solution I see is using a page as "sort of" API ... but I think that would be an ugly solution.