I am getting this error when I try and verify.
var decoded = jwt.verify(req.headers.authorization, "12345");
req.headers.authorization is giving me this value: Basic TGlua1NoYWRlc0FsZXhhOjEyMzQ1
I've tried this as well but get the same error:
var decoded = jwt.verify(req.headers.authorization.split(' ')[1]), "12345");
Any ideas?
@glowlabs without knowing further details, it seems the requester is using Basic authentication scheme.
That is not a JWT, it is a base64 string containing "username:password".
Usually people use Bearer scheme with JWT as token. Anyway, you need to create the token by calling first jwt.sign().
i am getting this type of error after running POST request
{
"name": "NotAuthenticated",
"message": "jwt malformed",
"code": 401,
"className": "not-authenticated",
"data": {
"name": "JsonWebTokenError",
"message": "jwt malformed"
},
"errors": {}
}
any ref for username/password authentication?
Most helpful comment
@glowlabs without knowing further details, it seems the requester is using Basic authentication scheme.
That is not a JWT, it is a base64 string containing "
username:password".Usually people use Bearer scheme with JWT as token. Anyway, you need to create the token by calling first
jwt.sign().