I’m trying to access the logged-in user in a headless front end. According to the documentation, the route /wp-json/wp/v2/users/me?_wpnonce=""
should provide the logged-in user. However, to pass the nonce to the request, we created a new route with wp_create_nonce("wp-rest")
. Unfortunately, the nonce was invalid, as the route returned a 403 rest_cookie_invalid_nonce
error.
Perhaps there is a different way to access the logged-in user in a headless WordPress?