# Testing Authentication In Postman

**URL:** <https://discuss.dev.twitch.com/t/testing-authentication-in-postman/19561>\
**Category:** API\
**Created:** [January 17, 2019, 1:53pm UTC](https://discuss.dev.twitch.com/t/testing-authentication-in-postman/19561 "2019-01-17T13:53:44Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Doobie](https://avatars.discourse-cdn.com/v4/letter/d/ed655f/32.png) [@Doobie](https://discuss.dev.twitch.com/u/Doobie)\
**Post date:** [January 17, 2019, 1:53pm UTC](https://discuss.dev.twitch.com/t/testing-authentication-in-postman/19561/1 "2019-01-17T13:53:44Z")

</div>

Hey so we are using passport.js/TwitchStrategy, we are able to successfully authenticate through the browser. We cannot figure out how we can test authentication through Postman. We are trying to hit our endpoint through postman to authenticate through twitch. In Postman, the response sends back HTML and if you go to the preview Tab and enter your credentials nothing happens. How can we go about solving this issue?

Thanks!

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [January 17, 2019, 1:55pm UTC](https://discuss.dev.twitch.com/t/testing-authentication-in-postman/19561/2 "2019-01-17T13:55:58Z")

</div>

Sounds like you are testing the oAuth authentication loop in postman…

You can’t test oAuth loops in postman, since step one of oAuth is redirect user to Service in order to authorise the application.

> [@Doobie](#):
>
> We are trying to hit our endpoint through postman to authenticate through twitch.

Your end point?

This sounds like you are misusing postman…

---

<div class="post-metadata">

**Author:** ![Doobie](https://avatars.discourse-cdn.com/v4/letter/d/ed655f/32.png) [@Doobie](https://discuss.dev.twitch.com/u/Doobie)\
**Post date:** [January 17, 2019, 2:13pm UTC](https://discuss.dev.twitch.com/t/testing-authentication-in-postman/19561/3 "2019-01-17T14:13:24Z")

</div>

So we have our own server using passport/twitch.js… say we go to localhost:3000/api/auth/twitch… it will hit our endpoint to check if user is authenticated using passport-twitch. This will redirect a browser to twitch’s login screen to either enter credentials or redirect to the callback url specified in the registration. Works fine and dandy… If we do the same in postman, there isn’t a redirect to twitch login screen to authorize. So we are trying to find a way to hit our endpoint (localhost:3000/api/auth/twitch) through postman, allow a redirect to happen within postman, enter credentials, get redirected to our server callback and be authenticated. Are you saying this is not possible at all?

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [January 17, 2019, 2:14pm UTC](https://discuss.dev.twitch.com/t/testing-authentication-in-postman/19561/4 "2019-01-17T14:14:19Z")

</div>

> [@Doobie](#):
>
> Are you saying this is not possible at all?

Postman is generally designed to test poking an API.

It doesn’t implement an oAuth authentication loop/dance.

Postman expects you to give it a token you already generated.

---

<div class="post-metadata">

**Author:** ![Doobie](https://avatars.discourse-cdn.com/v4/letter/d/ed655f/32.png) [@Doobie](https://discuss.dev.twitch.com/u/Doobie)\
**Post date:** [January 17, 2019, 2:17pm UTC](https://discuss.dev.twitch.com/t/testing-authentication-in-postman/19561/5 "2019-01-17T14:17:43Z")

</div>

So we found an example: [https://www.toolsqa.com/postman/oauth-2-0-authorization-with-postman/](https://www.toolsqa.com/postman/oauth-2-0-authorization-with-postman/)

Are you saying this still isnt possible?

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [January 17, 2019, 2:19pm UTC](https://discuss.dev.twitch.com/t/testing-authentication-in-postman/19561/6 "2019-01-17T14:19:26Z")

</div>

Try those instructions then.

Just make sure you are ONLY using Postman and not trying to throw your own API endpoint into the mix.

One or the other not both

---

<div class="post-metadata">

**Author:** ![system](https://d2opxh93rbxzdn.cloudfront.net/original/2X/0/05909729875cce3b53e59d5561c4d23bb14948fc.png) [@system](https://discuss.dev.twitch.com/u/system)\
**Post date:** [February 16, 2019, 2:19pm UTC](https://discuss.dev.twitch.com/t/testing-authentication-in-postman/19561/7 "2019-02-16T14:19:30Z")

</div>

Closed on February 16, 2019, 2:19pm UTC

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