How to authenticate and post article on realworld app

Hi all, can I get some help with a basic operation on this app?

I’m trying to log in with a Postman request tab and then post an article with a a 2nd request tab.

In the API spec for the app, it shows how to log in using a JSON body, and that request is working ok in Postman. But posting an article results in a 401 error.

I’ve tried setting Auth for the create article POST request to Inheret auth from parent, basic auth with credentials, and No Auth. But nothing works.

I’m able to get this operation set up and working fine in Cypress, but not Postman.

Here’s a link to the collection:

Can someone please help? thanks

As you could see from the image above the content you set is javascript hence the error.

When the content type is changed to json. Login works

As far as the second request is concerned you didn’t pass request headers needed. So please place the mandate request headers and try once

Hi thanks for reply. For the second request, I don’t now how to set request headers. I only know how to pass query and path parameters.

Can you tell me about the request headers for the second request and how to set them? The spec for the API doesn’t show anything about setting request headers. It only shows methods, endpoints, and bodies. So I can’t understand. Thanks again.

Just open the developer tools while you are using the actual site and click on the request you could see the information about URL, RESPONSE HEADERS, REQUEST HEADERS in the right tab. Just right click on the second request and select copy as curl bash cmd then come to postman and in the top left corner you could see import. In that click on import. Select the paste as raw text option and paste it. In the end just remove the compressed text and give import. You could see all the headers getting imported.

If any header is dynamically loaded then correlate the value from first request and pass it to the second one. I guess token value from first response needs to passed in the header of second request