# Add \`Origin\` header to OAuth 2.0 flow

**URL:** <https://community.postman.com/t/add-origin-header-to-oauth-2-0-flow/39402>\
**Category:** Help Hub\
**Tags:** authentication\
**Created:** [September 23, 2022, 7:43am UTC](https://community.postman.com/t/add-origin-header-to-oauth-2-0-flow/39402 "2022-09-23T07:43:49Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![juriy84](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/juriy84/32/7121_2.png) [@juriy84](https://community.postman.com/u/juriy84)\
**Post date:** [September 23, 2022, 7:43am UTC](https://community.postman.com/t/add-origin-header-to-oauth-2-0-flow/39402/1 "2022-09-23T07:43:49Z")

</div>

This question is related to the problem described in a following StackOverflow question: [authentication - Getting access tokens from Postman: Tokens issued for the 'Single-Page Application' client-type may only be redeemed via cross-origin requests - Stack Overflow](https://stackoverflow.com/questions/61231144/getting-access-tokens-from-postman-tokens-issued-for-the-single-page-applicati).

During OAuth 2.0 “authorization code with PKCE” grant, Azure AD requires `Origin` header to be present on the request to `/token` endpoint. If header is not present, authorization flow fails with the following error:

> Error: AADSTS9002327: Tokens issued for the ‘Single-Page Application’  
> client-type may only be redeemed via cross-origin requests

Unfortunately, Postman is not adding this header to the flow, hence the request for a token fails.

Is there a way to add a custom header into the requests that are executed behind “Get new access token” flow? I have tried adding headers to the request that the token is attached to, as well as “pre-request script”. Neither of these methods helped.

---

<div class="post-metadata">

**Author:** ![artmasa](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/artmasa/32/13340_2.png) [@artmasa](https://community.postman.com/u/artmasa)\
**Post date:** [September 28, 2022, 9:59pm UTC](https://community.postman.com/t/add-origin-header-to-oauth-2-0-flow/39402/2 "2022-09-28T21:59:08Z")

</div>

Any update on this? This is kind of urgent to test API’s dependent on SPA

---

<div class="post-metadata">

**Author:** ![hbertsch](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/hbertsch/32/3430_2.png) [@hbertsch](https://community.postman.com/u/hbertsch)\
**Post date:** [January 12, 2023, 11:29am UTC](https://community.postman.com/t/add-origin-header-to-oauth-2-0-flow/39402/3 "2023-01-12T11:29:50Z")

</div>

Having the same issue, since Microsoft forced PKCE now. Postman is no longer an option for our tests now

---

<div class="post-metadata">

**Author:** ![makanmakan83](https://avatars.discourse-cdn.com/v4/letter/m/d9b06d/32.png) [@makanmakan83](https://community.postman.com/u/makanmakan83)\
**Post date:** [January 13, 2023, 1:14pm UTC](https://community.postman.com/t/add-origin-header-to-oauth-2-0-flow/39402/4 "2023-01-13T13:14:51Z")

</div>

Same issue here … please add some feature that we can add header information in the Authorization flow.

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [January 14, 2023, 5:20pm UTC](https://community.postman.com/t/add-origin-header-to-oauth-2-0-flow/39402/5 "2023-01-14T17:20:39Z")

</div>

Surely if you use sendRequest() in a pre-request script, then you are in full control of what headers are sent.

---

<div class="post-metadata">

**Author:** ![joshkslalom](https://avatars.discourse-cdn.com/v4/letter/j/bbce88/32.png) [@joshkslalom](https://community.postman.com/u/joshkslalom)\
**Post date:** [February 17, 2023, 7:54pm UTC](https://community.postman.com/t/add-origin-header-to-oauth-2-0-flow/39402/6 "2023-02-17T19:54:20Z")

</div>

This doesn’t work for PKCE. PKCE is a client-based flow which involves the use of a browser and redirects.

---

<div class="post-metadata">

**Author:** ![aridzi](https://avatars.discourse-cdn.com/v4/letter/a/dfb087/32.png) [@aridzi](https://community.postman.com/u/aridzi)\
**Post date:** [June 18, 2024, 3:43pm UTC](https://community.postman.com/t/add-origin-header-to-oauth-2-0-flow/39402/7 "2024-06-18T15:43:05Z")

</div>

I have found a solution, hope this works for you:

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/d/a/da81df910c435bca31bca35c8fb88c6234803d8a.png)

---

<div class="post-metadata">

**Author:** ![rreis27](https://avatars.discourse-cdn.com/v4/letter/r/0ea827/32.png) [@rreis27](https://community.postman.com/u/rreis27)\
**Post date:** [August 12, 2025, 7:23pm UTC](https://community.postman.com/t/add-origin-header-to-oauth-2-0-flow/39402/8 "2025-08-12T19:23:13Z")

</div>

This is a solution, but refreshing will not work due to the same error as the OP
