# Using Postman to test web app secured by Auth0

**URL:** <https://community.auth0.com/t/using-postman-to-test-web-app-secured-by-auth0/101349>\
**Category:** Get Help\
**Tags:** new-universal-login-experience, login-experience\
**Created:** [February 27, 2023, 9:42am UTC](https://community.auth0.com/t/using-postman-to-test-web-app-secured-by-auth0/101349 "2023-02-27T09:42:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![yassineferjani](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/yassineferjani/32/30735_2.png) [@yassineferjani](https://community.auth0.com/u/yassineferjani)\
**Post date:** [February 27, 2023, 9:42am UTC](https://community.auth0.com/t/using-postman-to-test-web-app-secured-by-auth0/101349/1 "2023-02-27T09:42:12Z")

</div>

Hey there!  
We have a web application, and we are using Auth0 to grant access to our users, from auth0 dashboard I created a regular web application, did all the required configuration (our web app is a j2ee application) and everything is working fine. Users login using Universal login page by entrering his email and password  
Here is the issue now, we started creating some webservices in our application, that will be consumed later but a mobile app. When I try to test these webservices using postman, it’s not working, it always returns in response body the login page, despite the fact that I’m adding to Postman the required configuration to obtain a token au shown blow  
Am I missing someything in my configuration?  
Thanks

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

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [February 27, 2023, 11:28pm UTC](https://community.auth0.com/t/using-postman-to-test-web-app-secured-by-auth0/101349/3 "2023-02-27T23:28:55Z")

</div>

Hi @yassineferjani,

Thanks for reaching out to the Auth0 Community!

After taking a closer look at your screenshot, I noticed that you are calling the Authorization Code grant type in your request. This will redirect the user to the login page to prompt them for their credentials.

In the authorization code flow, you must exchange the code that is returned from the `/authorize` endpoint to get an access token.

For example:

```auto
https://{yourDomain}/authorize?
    response_type=code&
    client_id={yourClientId}&
    redirect_uri={https://yourApp/callback}&
    scope={scope}&
    state={state}

```

Response:

```auto
HTTP/1.1 302 Found
Location: {https://yourApp/callback}?code={authorizationCode}&state=xyzABC123

```

Then, you can take this code and pass it to the `/oauth/token` endpoint to get an access token.

```auto
curl --request POST \
  --url 'https://{yourDomain}/oauth/token' \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data grant_type=authorization_code \
  --data 'client_id={yourClientId}' \
  --data 'client_secret={yourClientSecret}' \
  --data 'code=yourAuthorizationCode}' \
  --data 'redirect_uri={https://yourApp/callback}'

```

For more information, please check out our [Add Login Using the Authorization Code Flow](https://auth0.com/docs/get-started/authentication-and-authorization-flow/add-login-auth-code-flow) documentation.

Please let me know how this goes for you.

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![yassineferjani](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/yassineferjani/32/30735_2.png) [@yassineferjani](https://community.auth0.com/u/yassineferjani)\
**Post date:** [February 28, 2023, 2:40pm UTC](https://community.auth0.com/t/using-postman-to-test-web-app-secured-by-auth0/101349/4 "2023-02-28T14:40:45Z")

</div>

Thanks @rueben.tiow for answering

When I call this url after seetting the right param  
https://{yourDomain}/authorize?  
response\_type=code&  
client\_id={yourClientId}&  
redirect\_uri={[https://yourApp/callback](https://yourApp/callback)}&  
scope={scope}&  
state={state}

I’m not getting in fact TTP/1.1 302 Found, I’m getting instead 200 ok and Auth0 login page

Looks like I’m missing something in my configuration…

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [March 1, 2023, 9:40pm UTC](https://community.auth0.com/t/using-postman-to-test-web-app-secured-by-auth0/101349/5 "2023-03-01T21:40:09Z")

</div>

Hi @yassineferjani,

Thank you for your response.

> [@yassineferjani](#):
>
> I’m not getting in fact TTP/1.1 302 Found, I’m getting instead 200 ok and Auth0 login page

That is correct. The user must enter their credentials on the login page, and if it is correct, they are redirected to your callback URL (the same as the `redirect_uri` of the request) with the code, which you can use to exchange with the `/oauth/token` endpoint for an access token.

Alternatively, there is the option to use the [Resource Owner Password Flow](https://auth0.com/docs/get-started/authentication-and-authorization-flow/resource-owner-password-flow), which may be what you’re looking for.

Could you please give it a try and let me know how it goes for you?

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![yassineferjani](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/yassineferjani/32/30735_2.png) [@yassineferjani](https://community.auth0.com/u/yassineferjani)\
**Post date:** [March 3, 2023, 11:43am UTC](https://community.auth0.com/t/using-postman-to-test-web-app-secured-by-auth0/101349/6 "2023-03-03T11:43:25Z")

</div>

Thanks @rueben.tiow the worflow you describe is working fine now 🙂 there was something missing in my side (in my application code)  
Now I’m able to get the token and use it to call my webservices  
Thank you

---

<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:** [March 17, 2023, 11:44am UTC](https://community.auth0.com/t/using-postman-to-test-web-app-secured-by-auth0/101349/7 "2023-03-17T11:44:07Z")

</div>

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