I'm receiving a JWT token I need to verify, which I split to get the token and remove the word bearer:
const bearerHeader = req.headers['authorization'];
const bearer = bearerHeader.split(" ")
With obfuscation on I get:
[
'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1OTgyNjU5NjksImlhdCI6MTU5ODI2NTM2OX0.gYp5wThUw8E7F-I0yhOvMuCwWkCNd8v1XomsWKnm2ss'
]
With obfuscation off I get:
[
'Bearer',
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1OTgyNjU5NjksImlhdCI6MTU5ODI2NTM2OX0.gYp5wThUw8E7F-I0yhOvMuCwWkCNd8v1XomsWKnm2ss'
]
Looks like white spaces are replaced with some other character that breaks the split(" ") code. I also noticed a bunch of \x20 in my console output instead of spaces. What gives? How can I fix this?
I'm receiving a JWT token I need to verify, which I split to get the token and remove the word bearer:
With obfuscation on I get:
With obfuscation off I get:
Looks like white spaces are replaced with some other character that breaks the
split(" ")code. I also noticed a bunch of \x20 in my console output instead of spaces. What gives? How can I fix this?