CORS with preflight check from browser

Rojoss
New Member

Hello, I’m trying to use the API to make a request from the browser.
Unfortunately the request gets blocked by CORS.
When I make the request from shell it works fine but since the browser sends the options preflight first the server doesn’t accept it.
Is there a way around this or can I whitelist the origin?

fetch('https://INSTANCE_ID.looker.com:19999/api/3.1/user', {
            method: 'GET',
            headers: new Headers({
                'Authorization': 'token xxx'
            })
        });

Access to fetch at ‘https://xxx.looker.com:19999/api/3.1/user’ from origin ‘https://localhost:3333’ 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. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.

0 5 857