Testing Authentication In Postman

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!

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.

Your end point?

This sounds like you are misusing postman…

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?

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.

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

Are you saying this still isnt possible?

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

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