Rest api auth error
-
HIi i’m building nextjs headless cms using wp and wc rest api
currently hosting from aws lightsail we migrated from siteground. There was no problem with data fetching, everything was working until i tried to test out my headless cms.
i hosted another website with same domain and there was a lot of conflicts, i deleted the new hosted website immediately.
but ever since all the rest api data fetching returns 401 unauthorized “You can’t not list the resources”.
none of the authorization methods works.
const WooCommerceRestApi =require(“@woocommerce/woocommerce-rest-api”).default;
export const api = new WooCommerceRestApi({
url:process.env.DB_WEB,
consumerKey: process.env.DB_KEY,
consumerSecret: process.env.DB_TOKEN,
version: “wc/v3”, });
doesn’t work passing em to headers even basic auth doesn’t work with username and password.
only some of them does work if i pass my consumer key and secret them into params I tried to fix it by making new website/ import back ups/ connect domain/ get fresh credentials, clear cache.i haven’t gotten any close to fixing it
“code”: “woocommerce_rest_cannot_view”,
“message”: “Sorry, you cannot list resources.”,
“status”: 401
- The topic ‘Rest api auth error’ is closed to new replies.