Code Monkey home page Code Monkey logo

Comments (7)

Thalhammer avatar Thalhammer commented on July 2, 2024

Currently the only documentation are the example in README.md and the various testcases in *Test.cpp

from jwt-cpp.

nicraMarcin avatar nicraMarcin commented on July 2, 2024

:(

from jwt-cpp.

Thalhammer avatar Thalhammer commented on July 2, 2024

I almost forgot about it, but most of the methods are commented with doxygen comments and there is a doxygen config in the root. It's not really a complete documentation, but it might help.

from jwt-cpp.

paulotovo avatar paulotovo commented on July 2, 2024

Hello Thalhammer,

I have seen on several sites about the header "typ" parameter that must be configured as JWT.
For example: "typ" : "JWT"
But on RFC says:
"The "typ" (type) Header Parameter defined by [JWS] and [JWE] is used
by JWT applications" and " If present, it is RECOMMENDED that
its value be "JWT" to indicate that this object is a JWT."

In your examples you use "typ" : "JWS".

What would be the difference? What would be the correct use?

Thanks.

Best Regards

Paulo

from jwt-cpp.

Thalhammer avatar Thalhammer commented on July 2, 2024

@paulotovo According to the rfc that part is optional and should not be used by the jwt library.
It defines the media type and could be used to disabiguate if you expect not only jwt tokens to hit your app. JWT stands for Json Web Tokens and JWS for Json Web Signature which is a different, but very similar rfc. In 99% of cases it does not matter and the reason my test token uses JWS is simply a coincidence.

from jwt-cpp.

minjax avatar minjax commented on July 2, 2024

Continuing with the theme of API documentation/examples, the example given shows get_payload_claims() in this context:

      std::string token = "eyJhbGciOiJIUzI1...OkEE";
      auto decoded = jwt::decode(token);

      for( auto& e : decoded.get_payload_claims() )
          std::cout << e.first << " = " << e.second.to_json() << std::endl;

but, I don't find any definition of get_payload_claims() in class jwt::decoded_jwt<jwt::picojson_traits> or otherwise...

What am I missing here?

Thanks,

from jwt-cpp.

prince-chrismc avatar prince-chrismc commented on July 2, 2024

The current master is a getting ready for an release candidate, and rightfully so because it seem like get_payload_claims got removed during #71 by accident 😨

I would strongly recommend using the v0.4.0 release while the last few details get ironed out. ( I am using that in production code ) The method in question is available there.

std::unordered_map<std::string, claim> get_payload_claims() const { return payload_claims; }

Sorry for the inconvience!

from jwt-cpp.

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.