benmcollins / libjwt

JWT C Library
Mozilla Public License 2.0
342 stars 163 forks source link

String format is different for a property between jwt_get_grants_json and jwt_get_grant #198

Open psuresh1983 opened 2 weeks ago

psuresh1983 commented 2 weeks ago

When i try read below data as json with jwt_get_grants_json then it escapes \n with another \ "pubkey":"-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsVxVj1TuPN4otznshtFyCIns"

But when I try to read the grant with "pubkey" using jwt_get_grant then the correct format is returned.

benmcollins commented 2 weeks ago

JSON formatting will escape characters. This is expected, I believe.

psuresh1983 commented 2 weeks ago

The data what i had sent over network is of this format in json. The recipient has received and signed this data. No escape character added to the signed data so far in the step. But when im trying to fetch using jwt_get_grants_json, its adding extra escape character which was not expected.

benmcollins commented 2 weeks ago

I'd have to dig into the code to see if there is an error in LibJWT or Jannson.

benmcollins commented 2 weeks ago

Can you provide the JWT in question?

psuresh1983 commented 2 weeks ago

eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJwdWJrZXkiOiItLS0tLUJFR0lOIFBVQkxJQyBLRVktLS0tLVxuTUlJQklqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUFzVnhWajFUdVBONG90em5zaHRGeUNJbnNyTW5nMzNYWjQ2TEFVN01oUmUvMnNRekIzTy92djlTeGdtM0U1ZGREMm1mWm51dlA5SXpRRTR4ZlNmSWRiQnl3cWZsZit2V3A5alhuNXdlbkVUVWx6WlVCbWRWbFRmeGM5cjByQXMwMUVZaWt3Mk00SGdsUmdtRDJmd0lvSzJXQ0xvWnZTVURkOHA4dGdJWHFkWmdyTTVGRVYrekZCVWxuWDhrRnU0Tm9MVU8xNzBPTW5xMDQxNldJNWVGODlJYVg3UjZiSUtXbmoxOVFUSk1RY2RtSUR3WXg5K0dFdWhQNUhqSGVrempubXlCaXBVT0JFY2ZPcXRhRXdGWHljRjM2bTBYREEva01OejIvbml0b2lRaE5EYk5TcnpjNW4zU2tUUjd1TURZcy91c1BCMXdBVCtmd0N1bWtNWERjOFFJREFRQUJcbi0tLS0tRU5EIFBVQkxJQyBLRVktLS0tLSJ9.P2QYTJfND4z6G7oWWPHKULUAPtda6x7OMaQW7Bjser9gHAfkHlgizv3li2TOCl0RmWFvZp78X_jZJTorzQhDN350nkN2P0J4vIXNJ6sh8o8rdaKPvki2_V-wf4gY-KURm3jof5HBdsAmdw-D2pXTt2vGxjaLwRTnYUvVFpov_TLooN6kjqGz8yh4QzO043ErmvH-n31ts1E3Yaik2UVWVJ74N45S2kX9nwvn_wU5SQaK7VO8yIb1KhPb-8-PPtY_OCaKDA8MHiyYR_yZLXReuKWKyV9dOI0NXrPTh6IkS7Y-92Gjunz-6qyvYfHP_BGt59945ggsD3rL1v0lFq3lqw