Thread Starter
kreeem
(@kreeem)
Thanks Ali for the support!
I finally find a solution, by adding an additional ‘Access-Control-Allow-Origin’: ‘*’ header into my post requests.
Code
axios({
method: 'post',
url: "https://my-site.com/myapi/user/generate_auth_cookie/?nonce=${nonce}&username=${username}&password=${password}",
config: {
headers: {
'Access-Control-Allow-Origin': '*',
}
}
})
-
This reply was modified 7 years, 6 months ago by kreeem.
Thread Starter
kreeem
(@kreeem)
Hi Ali,
Thank you for the quick reply. Unfortunately neither method was working.
I even reinstalled both JSON API, and JSON API USER plugins, then edited api.php file again.
I also tried editing two different wordpress themes functions.php, but Im still getting the same error message.
However, while I am using “Allow-Control-Allow-Origin: *” Google Chrome plugin, the issue is not present. (This is a suitable solution while developing, but not on production. )
Do you have maybe other suggestion?