How do you call the /user/tokens/verify API from the browser?

I'm trying this:

const response: Response = await window.fetch(
  'https://api.cloudflare.com/client/v4/user/tokens/verify',
  {
    method: 'GET',
    mode: 'no-cors',
    headers: new Headers({
      Authorization: `Bearer ${apiToken}`,
      'Content-Type': 'application/json',
    }),
  },
);


This is the same code as the official documentation except with mode: 'no-cors' because CORS rejects requests from localhost.

Unlike the documentation, this only responds with "400 Bad Request."
Interact with Cloudflare's products and services via the Cloudflare API
Was this page helpful?