In integration tests I try to test if events were reported and tried to read the events from the web API using the test running in the browser, but the request got rejected with
response for preflight has invalid HTTP status code 401
The security model is different for browser access to the API. I recommend using a server-side language, and double-check that the auth token you generated has read access to your events.