# Auth0 PKCE Postman test automation

**URL:** <https://community.auth0.com/t/auth0-pkce-postman-test-automation/60104>\
**Category:** Get Help\
**Tags:** pkce, postman, auth0\
**Created:** [March 26, 2021, 10:46am UTC](https://community.auth0.com/t/auth0-pkce-postman-test-automation/60104 "2021-03-26T10:46:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![eugenio.favalli](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/eugenio.favalli/32/16414_2.png) [@eugenio.favalli](https://community.auth0.com/u/eugenio.favalli)\
**Post date:** [March 26, 2021, 10:46am UTC](https://community.auth0.com/t/auth0-pkce-postman-test-automation/60104/1 "2021-03-26T10:46:27Z")

</div>

Hi everyone,  
I’m trying to automate some APIs tests with postman.  
APIs are secured by Auth0 and we’re connecting with a mobile app (Authorization code flow + PKCE).  
I see now postman has the feature to support PKCE, but it seems the token I get back is not a properly formed bearer token.

Some example below.

 ![image](https://global.discourse-cdn.com/auth0/original/3X/4/f/4fda9d0aca6558985ba4c2d6d57e4a18306eda0b.png)

 ![image](https://global.discourse-cdn.com/auth0/original/3X/a/2/a262457192f7bb3491b2a0b1c532823ad5f5e989.png)

![image](https://global.discourse-cdn.com/auth0/original/3X/e/1/e1ecee3d974b836420adcdc2e6a84d4d3fac8d62.png)

---

<div class="post-metadata">

**Author:** ![ricardo.batista](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ricardo.batista/32/7711_2.png) [@ricardo.batista](https://community.auth0.com/u/ricardo.batista)\
**Post date:** [March 26, 2021, 11:57am UTC](https://community.auth0.com/t/auth0-pkce-postman-test-automation/60104/2 "2021-03-26T11:57:32Z")

</div>

Hi @eugenio.favalli

You’re getting an opaque access token most likely because you’re not including an audience in the authorize request. You can configure a [custom API in the Auth0 dashboard](https://auth0.com/docs/get-started/set-up-apis) and then use its identifier in the authorize request, as the audience.

You can try changing your Auth URL to something like:

> https://{{auth0Domain}}/authorize?audience=YOUR\_API\_IDENTIFIER

You can also read more about opaque and JWT access tokens here:

> **[Access Tokens](https://auth0.com/docs/secure/tokens/access-tokens)**
>
> Describes how access tokens are used in token-based authentication to allow an application to access an API after a user successfully authenticates and authorizes access.

[https://auth0.com/docs/tokens/access-tokens/get-access-tokens#control-access-token-audience](https://auth0.com/docs/tokens/access-tokens/get-access-tokens#control-access-token-audience)

---

<div class="post-metadata">

**Author:** ![eugenio.favalli](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/eugenio.favalli/32/16414_2.png) [@eugenio.favalli](https://community.auth0.com/u/eugenio.favalli)\
**Post date:** [March 26, 2021, 1:09pm UTC](https://community.auth0.com/t/auth0-pkce-postman-test-automation/60104/3 "2021-03-26T13:09:51Z")

</div>

Indeed adding the audience as the first parameter of the authorize request did the trick.  
I also realized that myself, thanks anyway 🙂

---

<div class="post-metadata">

**Author:** ![eugenio.favalli](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/eugenio.favalli/32/16414_2.png) [@eugenio.favalli](https://community.auth0.com/u/eugenio.favalli)\
**Post date:** [March 26, 2021, 1:35pm UTC](https://community.auth0.com/t/auth0-pkce-postman-test-automation/60104/4 "2021-03-26T13:35:09Z")

</div>

The same trick doesn’t work on client credentials flow though, still I need to specify audience, but in a POST request now and postman doesn’t seem to allow that

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [April 10, 2021, 1:35pm UTC](https://community.auth0.com/t/auth0-pkce-postman-test-automation/60104/5 "2021-04-10T13:35:55Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
