Relative Content

Tag Archive for reactjswordpressapiheadlessnonce

get logged in user with headless wordpress

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.

get logged in user in wordpress with headless frontend

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.