vscode-restclient
vscode-restclient copied to clipboard
Invalid character in header content ["authorization"]
- REST Client Version: v0.24.6
- VSCode Version: 1.63.0
- OS Version: Windows 10 Pro 20H2 - 64-bit
Steps to Reproduce:
- Create a new .http file
- Add these lines: GET http://localhost:8080/api/events/v1 content-type: application/json; charset=utf-8 Authorization: Bearer A_LONG_TOKEN
Expected Return api results
Actual
I see Invalid character in header content ["authorization"]
@SebasLealLaunchtrip could you please provide your long authorization header value?
Invalid character in header content ["Authorization"] i got this error in postman please help me
@Huachao sorry for my late reply. So, I most likely had a character issue when I copied the token from the browser console. I remember it worked with another token. I don't have the specific scenario at hand in this moment. For my side I'd close this issue. @sanivarapuharsha maybe you can also check you token string to see if it's valid.
Most likely you CTRL + C
(CMD + C
) the token. Right click and select the Copy Value
option instead

is it happen when we dont store bearer token in correct way in postman
This actually happens when you have a token generated with characters such as (mostly) three dots '...'somewhere in the token. Postman does not know how to handle that, unfortunately, whereas jwt.io can decode the token just perfectly. You could try to produce the token using postman.
.
actually i am getting error in the postman, when giving token.
Error: Invalid character in header content ["Authorization"]
Check your Token. It is a token issue.
I was getting this when the token ended with a newline \n
Most likely you
CTRL + C
(CMD + C
) the token. Right click and select theCopy Value
option instead![]()
@caverac Thank you for making it work. So why doesn't "ctrl + C" work?
Most likely you
CTRL + C
(CMD + C
) the token. Right click and select theCopy Value
option instead@caverac Thank you for making it work. So why doesn't "ctrl + C" work?
I just had this issue, and indeed there was a newline character at the end of my token. The reason this happens when you use Ctrl+ C
is that when you highlight the text, sometimes it picks up a line break, sometimes it doesn't. If you don't want to generate a new token, you can also try just removing any whitespace at the end of your token, wherever it's stored.
I was able to remove the newline character from my token and it started working!
It is worth all the energy to configure variables in your postman environment, that can even be set directly from login api; by running tests after calling login, instead of using browser copied tokens. Its faster and avoids these inconveniences, and permanent, at least as long as you have the environment.