Difficulty in getting corrrect response from GET request after entering Bearer token

Your question may already have an answer on the community forum. Please search for related topics, and then read through the guidelines before creating a new topic.

Here’s an outline with best practices for making your inquiry.

My question:
My bearer token is correct and ive also included the header. But my GET request still won’t work properly even after logging the user in. How to I get it to work?

Details (like screenshots):

How I found the problem:

I’ve already tried:
I tried registering another user. But the required response message isn’t appearing

Hi @sharvarijoshi

Not sure what the issue may be but perhaps you could clarify a few things.

You send the “login” endpoint and email and password, which is how you get the token?
You then use that token as a header value to check the “secured” endpoint to try and login?

Simple things to check:
Is the account (related to the Email and password) valid/locked?
Is the Authorization tab set to use “Bearer Token”?
Are the localhost endpoints up and running?

Suggestion:
Save the token as a collection variable (you can use this: pm.collectionVariables.set(“accessToken”, pm.response.json().token); )

and then in you header you have the Auth value be Bearer {{token}}.

That will stop the chance of any mistakes from copying and pasting the access token in to the header value.