GatsbyJS & Wordpress REST API 401 Unauthorized Error GatsbyJS & Wordpress REST API 401 Unauthorized Error wordpress wordpress

GatsbyJS & Wordpress REST API 401 Unauthorized Error


Here's how I got rid of the 401 Unauthorized warnings in gatsby-source-wordpress plugin (click here for documentation on npm).

The warning:

Path: /wp-json/wp/v2/users/me?per_page=100&page=1The server response was "401 Unauthorized"Inner exception message: "You are not currently logged in."

Only include the routes you need using includedRoutes setting in gatsby-config.js:

includedRoutes: [    "**/posts",    "**/pages",    "**/media",    "**/categories",    "**/tags",    "**/taxonomies",    // "**/users", // uncomment this and watch the warning above reappear!    "**/menus",],


Worth a try is to try disabling all your WordPress plugins and see if it works. If so, try re-enabling them one at a time and see which one could be causing issues.


Have been getting th same error. And running verboseOutput: true gives the information that it can't access these endpoints:

http://your-site.com/wp-json/wp/v2/users/mehttp://your-site.com/wp-json/wp/v2/settings

Which I guess is normal, because you would have to be logged in to access those pages.

If everything elese works for you, then I think you can ignore it.