Learn-to-send-email-via-google-script-html-no-server: CORS issue

Created on 14 Jun 2017  路  6Comments  路  Source: dwyl/learn-to-send-email-via-google-script-html-no-server

I have a new issue. the console log prints this message and I really don't know what it means.
Has this been solved before?
I麓m runnig a Xampp apache server to work with this.

XMLHttpRequest cannot load https://script.google.com/macros/s/AKfycbyhl9S5fO406P61lezf_mmSh5Oq5s_SeZw1a6tMnHIlP3xkgw0/exec. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access. The response had HTTP status code 401.

image

help wanted question

Most helpful comment

Thanks! yes, I would like to translate the tutorial, and I am happy with this, I will close it. Thank you again.

All 6 comments

@denyncrawford are you using any PHP code? (_wondering why using XAMPP as server..._)
if you have node.js on your computer try: npm install && npm start which will open "Live Server" so you can test if it's XAMPP that is causing the issue...
Google _expects_ you to submit the form from a different Origin.

@nelsonic No, I do not have node.js but I will try anyway, however I ran my web without the server and the problem persists. I use apache because some js-plugins need this.

OK, so I believe this issue is related to a server config. We've seen a number of these issues, but I haven't reproduced them. May depend on browser, web settings, server settings, etc. See https://stackoverflow.com/questions/20035101/no-access-control-allow-origin-header-is-present-on-the-requested-resource

Well, I found the solution on my own, it was not a server problem or something, it was my fault. In the version of the app I did not change the "Who has access to the app" option. So the application blocked other users access (JavaScript). To fix it, I just made another version of my app and changed the option to "Everyone, even anonymous". And _eureka!_

I opened a question on stackoverflow and I answered it myself, for those who are interested, if they have the same problem.

If you know Spanish, you can see the whole thing here

Maybe you should open a translation in the documentation so that more public can understand it without any problems. Thank you for your answers.

Linked to #78.

Thanks for posting your solution @denyncrawford, I think you're right, we need to make this bit clearer in the readme!

If you'd like to translate the tutorial we'd certainly welcome a PR! 馃槉

Let us know if you're happy to close this issue now that it's been resolved.

Thanks! yes, I would like to translate the tutorial, and I am happy with this, I will close it. Thank you again.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JintaYadomi picture JintaYadomi  路  3Comments

ThomasSalty picture ThomasSalty  路  4Comments

joseroma picture joseroma  路  3Comments

joshiadvait8 picture joshiadvait8  路  3Comments

vlknlvnt picture vlknlvnt  路  4Comments