Skip to content

valuestring parse is truncated #93

@b-rohit

Description

@b-rohit

I use JWT token for REST api on my server. I am able to parse correctly, but when I access of token using valuestring, it doesn't give complete value of the token, it is truncated. I received the following response from server.
{"token":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InJib2hyYSIsImlhdCI6MTU2MjA3NTE0NCwiZXhwIjoxNTYyMDc1MjA0fQ.jIimgiWP9fCJ8I31Bof_wxSawBr7fa8JBeSQDnl8zHyILCfdlNW-P-4swDQEIbqRXDt3U3nngw0F_VgOv2DcSulW_U1WnCLbHTQnaP9RDW4g2OSqqAdqrw7_qbey8grDjC8oQDZ6vLfI5MoP_5p5LocezSjeJkgorZAS9O9QU8Ib8Ggjwd6DUT-yhun93jQv_VTnY24V_ayQHXvohZFreDSB3oLDa-8xH1NDxUupVB8euuXs8lXsqxyQhH-O7-jA5kOeRnYtL8rSEkXRXyrej0r7iS9HqkodfQ9BN9O3FoKcaISsBp_zYlCFiPqHpFGARVQMJhmspLoiK7NFUIj-1Q"}

I parsed it this way..

aJsonObject* jresult = aJson.parse(buff);
aJsonObject* jwt = aJson.getObjectItem(jresult, "token");
const char *token = jwt->valuestring;

The token variable has following value.
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InJib2hyYSIsImlhdCI6MTU2MjA3NTE0NCwiZXhwIjoxNTYyMDc1MjA0fQ.jIimgiWP9fCJ8I31Bof_wxSawBr7fa8JBeSQDnl8zHyILCfdlNW-P-4swDQEIbqRXDt3U3nngw0F_VgOv2DcSulW_U1WnCLbHTQnaP9RDW4g2OSqqAdqrw7_qbey8grDjC8oQDZ6vLfI5MoP_5p5Loce

which is not complete value. How can I correct it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions