Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cors Restriction on Frappe version-13 #47

Open
mymi14s opened this issue Dec 3, 2021 · 1 comment
Open

Cors Restriction on Frappe version-13 #47

mymi14s opened this issue Dec 3, 2021 · 1 comment

Comments

@mymi14s
Copy link

mymi14s commented Dec 3, 2021

There is cors policy restriction when used on frappe version-13, cors access in site_config has been set and javascript FETCH works well but renovation core is restricted., error below

Access to XMLHttpRequest at 'https://testbin.frappe.com/' from origin 'http://localhost:8080' has been blocked by CORS policy: Request header field x-client-site is not allowed by Access-Control-Allow-Headers in preflight response.

This error occurred in a VUEJS app.

SAMPLE code:

(async () => {
await renovation.init(backend, hostURL, "test-site")
// renovation.enableJWT(true)
const authResponse = await renovation.auth.login({
email: "administrator",
password: "password"
});
console.log("Successful login", authResponse.data.currentUser);
})();
// above did had cors policy issue, but below worked fine.

fetch('https://gherp.com/api/method/login', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
usr: 'administrator',
pwd: 'password'
})
})
.then(r => r.json())

@e-lobo
Copy link
Member

e-lobo commented Dec 4, 2021

@mymi14s
You can try these 2 things
=> if your using renovation_core frappe app please use branch version-13
=> try setting in your site_config allow_cors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants