L
L
londhor2020-05-20 18:51:22
Google
londhor, 2020-05-20 18:51:22

How to make a POST/GET request to googleScripts via fetch?

You need to deploy a Google script, with the ability to fetch data via fetch.

Now everything works if you click on the link in the browser.
For an example: click

But at attempt to receive the answer through GET we receive SyntaxError: Unexpected end of input(the answer comes empty).

POST throws 401 errors.

fetch('https://script.google.com/macros/s/AKfycbwl7XegZrDWmAen0Zb5aUAxF5shCV1fIwCsyGsB_aNJBJO3BRs/exec', {
    method: 'GET',
    mode:'no-cors',
    redirect:'follow'
}).then(res=>res.json());

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
aldexnotproger, 2020-05-20
@aldexnotproger

I think you need to send parameters in the POST request, login and password.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question