I am using trying to fetch data from wp to react via rest api. There are two API's I am working upon. First one is wp/v2/pages is working fine (With credentials it is authorized) but,

Second api wp/v2/menu-items or wp/v2/menus both are showing that you are not allowed to view this content (Even I am using the same credentials for authorization.

See Image Here

  • Who are you authenticated as? Are you authenticated as an admin? Jul 15 at 9:29
  • Well I am new in case of WP, I am using WP Rest-Api in React, So I dont know how to know whether I am an admin or user. But I am using admin credentials so yes authenticating as an Admin. Jul 15 at 10:24
  • "First one is wp/v2/pages is working fine (With credentials it is authorized)" - are you sure you're actually authenticated, or that the credentials were sent along with your request? "using the same credentials for authorization" - from where or how did you get that Token? Is it the Application Passwords section at wp-admin/profile.php, i.e. the page for editing your own profile?
    – Sally CJ
    Jul 15 at 11:47
  • The image shown is a plugin for auth and i used jwt auth in that, in postman i tried with basic auth using pwd and username it is working for /v2/pages but not for /v2/menus. Jul 15 at 11:57
  • 1
    So, you used your WordPress password? But anyway, try using cURL command line with an application password instead - go to the Profile admin page to generate an application password, then try with: curl https://your-domain/wp-json/wp/v2/menus -u "YOUR USERNAME:YOUR APPLICATION PASSWORD"
    – Sally CJ
    Jul 15 at 12:12


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.