#1 2018-03-02 17:22:45

fabioxgn
Member
Registered: 2015-11-06
Posts: 34

Payload value in JWT token returns null if the value has a { character

This token for example:

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOiJ7MUNDQTMzNkQtQTc4Ri00RUI2LUI3MDEtMURCOEU3NDlCRDFGfSIsInNjbSI6InRlc3RzIiwiYWRtIjp0cnVlLCJpc3MiOiJNb25kZSIsImlhdCI6MTUyMDAxMDA5OSwiZXhwIjoxNTIwMDEzNjk5LCJqdGkiOiIxMTcyNjlCNDY3NjkyNUREMjE2NDNBODAifQ.HpBbP6Dk9TiHSd3ZZ3u9QZUr_dAAhsuf_qe3cuc8j8c

in the JWT debugger it is valid and returns:

{
  "uid": "{1CCA336D-A78F-4EB6-B701-1DB8E749BD1F}",
  "scm": "tests",
  "adm": true,
  "iss": "Monde",
  "iat": 1520010099,
  "exp": 1520013699,
  "jti": "117269B4676925DD21643A80"
}

But when I use the verify method, it returns null for the "uid" payload:

('uid', 'scm', 'adm'), ('null', 'tests', 1), 3))

I've tried to debug a little bit and looks like that the { is making the JSON parser skip the uid value.

Offline

#2 2018-03-03 08:30:04

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,272
Website

Re: Payload value in JWT token returns null if the value has a { character

Yes, it detected and expected the field to be a JSON object...

Please check https://synopse.info/fossil/info/9ab8135838

Offline

Board footer

Powered by FluxBB