Giter Club home page Giter Club logo

Comments (3)

domenkozar avatar domenkozar commented on May 18, 2024 7

There is one use case not considered: copy/pasting JWT. That's needed when JWT is generated on the web and human has to copy it to a local terminal, bootstrapping their client that talks to the server.

There could be another variation of the token so that compression wouldn't be part of the header. Compression probably doesn't have to be adaptive, since there's not much to choose from.

However, there is a challenge how to compress small-sized JSON into ASCII representation.

from jwt.

Ocramius avatar Ocramius commented on May 18, 2024

/cc @DASPRiD

from jwt.

Ocramius avatar Ocramius commented on May 18, 2024

After discussing this with @lcobucci, we came to the conclusion that compressing tokens is just not worth it. Specifically, for following reasons:

  • when using JWT tokens in HTTP headers, HTTP2 already provides header compression
  • token compression algorithm identifier would have to be stored in JWT headers, which makes most of the token non-compressible anyway
  • tokens that are used as part of response bodies in HTTP requests/responses are already compressed by the user agent or the server
  • tokens that are stored are unlikely stored as base64 encoded, as the JSON structure (and signature) makes it easy to convert the data into more optimized formats. For example, storing a JSONB object in a Postgres database can lead to amazing results
  • tokens sent over the network can be re-coded into something else, if network impact and latency are relevant (for example, protobufs may be used)

Therefore, I'm closing this as "won't fix", as it really doesn't need a fix.

from jwt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.