I’m trying to generate an access token for my public app. However, I’m getting this error,
Access to fetch at 'https://test.myshopify.com/admin/oauth/access_token' from origin 'https://mydomain.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
I already tried adding the “Access-Control-Allow-Origin” on the request header, but I’m still getting that same error.
export function* postShopify(postData, access_token_url, content_type) {
return yield fetch(`${access_token_url}`, {
headers: {
'Access-Control-Allow-Origin': '*',
'Content-Type': `${content_type}`,
},
method: 'POST',
postData,
});
}
Is there a workaround solution you could recommend to fix that error without using the App Proxy?
Here are the references I used on how I can generate the access token