Skip to content

Is client side jwt-decode safe? #8

Closed
@bhtabor

Description

@bhtabor

First of all, thank you for this simple and elegant starter kit.

I do have one reservation over decoding JWT tokens on the client side. It is unsafe to have a JWT secret on the client side as it may be used to generate fake tokens that will pass server validation.

If this is just for highlighting how to use JWT, I think it would be best to at least mention such vulnerability on the README. What I usually do is generate the JWT token on an API server up on authentication request from the client. Then the client will save it locally (without decoding since the client doesn't have the JWT secret anyway) and, when requesting a protected data, send the token back to the API server with an Authorization header.

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