Monday, May 20, 2024
190
rated 0 times [  191] [ 1]  / answers: 1 / hits: 31712  / 9 Years ago, wed, may 27, 2015, 12:00:00

During the initial handshake where a token and username are passed, I am catching this strange error--



    { handle: 10,
type: 'error',
className: 'Error',
constructorFunction: { ref: 11 },
protoObject: { ref: 12 },
prototypeObject: { ref: 3 },
properties:
[ { name: 'stack',
attributes: 2,
propertyType: 3,
ref: 3 },
{ name: 'arguments',
attributes: 2,
propertyType: 1,
ref: 3 },
{ name: 'type',
attributes: 2,
propertyType: 1,
ref: 3 },
{ name: 'message',
attributes: 2,
propertyType: 1,
ref: 13 } ],
text: 'Error: Not enough or too many segments' }


malformed JWT? initial token malformed?


More From » authentication

 Answers
45

If you are using JWT-simple, by looking at the source code, we can see that this error is caused by the token having an incorrect form.



//...

var segments = token.split('.');
if (segments.length !== 3) {
throw new Error('Not enough or too many segments');
}

[#66446] Tuesday, May 26, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
braydon

Total Points: 0
Total Questions: 102
Total Answers: 111

Location: Sao Tome and Principe
Member since Wed, Dec 29, 2021
2 Years ago
;