ddboy19912
Forum Replies Created
-
I’ve been able to solve the styling problem. I was testing the build in my local environment so i just needed to make sure the path was same with the React directory and it was fine. Thanks a lot again
Hey,
Thank you so much that did the trick for me. Now when I export the build. I don’t get the images, fonts or icons in the frontend. I didn’t make any changes to the package files. It just happens this way.Forum: Plugins
In reply to: [WordPress REST API Authentication] CORS errorThank you very much for your response.
In my case, I’m basically trying to authenticate the API in my local environment (React setup). Kind of like this: https://localhost:5173/.
Initially I had the problem you were facing regarding ‘Access-Control-Allow-Origin’. I was able to bypass this through different ways. E.g installing a cors plugin on the browser, Install a cors plugin on wordpress or overriding the .htaccess file. After doing this, the error changed to the one I’m currently facing: https://i.ibb.co/ftcN2ry/Screenshot-2023-05-31-082317.png.
Thanks for your response. I’ll look into the forum you sent to see If it helps
Forum: Plugins
In reply to: [WordPress REST API Authentication] CORS errorThis did not work as well. I’ve sent a mail here [email protected]
Forum: Plugins
In reply to: [WordPress REST API Authentication] CORS errorI still get the same error using Basic auth in the React frontend. Here is a snippet of the fetching logic being employed
useEffect(() => { async function fetchResult() { try { const username = "username"; const password = "password"; const encodedCredentials = btoa(
${username}:${password}
); // Encode username and password const response = await axios.post( "https://localhost/wordpress/wp-json/wp/v2/pages", { headers: { Authorization:Basic ${encodedCredentials}
, // Include Basic Authentication header }, } ); console.log(response.data); } catch (error) { console.error("Error fetching token:", error); } } fetchResult(); }, []);