# Using PKCE but the token URI does not allow CORS

**URL:** <https://forums.combatlogforums.com/t/using-pkce-but-the-token-uri-does-not-allow-cors/11538>\
**Category:** General\
**Created:** [April 10, 2021, 5:38pm UTC](https://forums.combatlogforums.com/t/using-pkce-but-the-token-uri-does-not-allow-cors/11538 "2021-04-10T17:38:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Szeth](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.combatlogforums.com/szeth/32/1753_2.png) [@Szeth](https://forums.combatlogforums.com/u/Szeth)\
**Post date:** [April 10, 2021, 5:38pm UTC](https://forums.combatlogforums.com/t/using-pkce-but-the-token-uri-does-not-allow-cors/11538/1 "2021-04-10T17:38:12Z")

</div>

I’m trying to use the PKCE flow as I don’t have a server. I’ve gotten through setting up the whole flow with the code challenge and everything only to find out that “No ‘Access-Control-Allow-Origin’ header is present” on the token URI. Here’s the fetch:

```
await fetch('https://www.warcraftlogs.com/oauth/token', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    client_id: clientId,
    code_verifier: verifier,
    redirect_uri: 'http://localhost:8000/oauth',
    grant_type: 'authorization_code',
    code
  })
})

```

I’ve confirmed I’ve set up everything else correctly because just for kicks I tested it with a normal form POST and got an access token. Obviously, that won’t work for applications because the response is JSON and doesn’t redirect back to the application again.

I think for PKCE to work in a browser-based web app, you need to set the CORS header on the token URI.

Thanks!

---

<div class="post-metadata">

**Author:** ![catfush](https://avatars.discourse-cdn.com/v4/letter/c/76d3ee/32.png) [@catfush](https://forums.combatlogforums.com/u/catfush)\
**Post date:** [April 22, 2021, 4:55am UTC](https://forums.combatlogforums.com/t/using-pkce-but-the-token-uri-does-not-allow-cors/11538/2 "2021-04-22T04:55:51Z")

</div>

Currently having this exact issue. Does the API have cors improperly set up for PKCE or is there potentially user error on my end?

---

<div class="post-metadata">

**Author:** ![Kihra](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.combatlogforums.com/kihra/32/1116_2.png) [@Kihra](https://forums.combatlogforums.com/u/Kihra)\
**Post date:** [April 22, 2021, 5:29am UTC](https://forums.combatlogforums.com/t/using-pkce-but-the-token-uri-does-not-allow-cors/11538/3 "2021-04-22T05:29:25Z")

</div>

This should be fixed now.
