A C++14 library for creating, signing, verifying, and decoding JSON Web Tokens (JWT) with a clean API.
CPP-JWT is a C++14 library for working with JSON Web Tokens (JWT), a standard for creating access tokens with encoded claims. It handles the creation, signing, verification, and decoding of JWTs, supporting various cryptographic algorithms like HMAC, RSA, and ECDSA. The library solves the need for a robust, modern C++ implementation of JWT for authentication and authorization in C++ applications.
C++ developers building web services, APIs, or distributed systems that require secure token-based authentication. It's particularly useful for backend engineers implementing OAuth 2.0, OpenID Connect, or custom JWT-based security layers.
Developers choose CPP-JWT for its comprehensive feature set, modern C++ design, and dual error-handling approach. Unlike minimal implementations, it offers full RFC 7519 compliance, multiple algorithm support, and a clean API that reduces boilerplate while maintaining type safety and performance.
JSON Web Token library for C++
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Implements HS256/384/512, RS256/384/512, and ES256/384/512 for signing and verification, covering all major JWT algorithms as listed in the README's Support section.
Provides built-in validation for standard claims like issuer, subject, audience, expiration, and more, ensuring full RFC 7519 compliance without manual checks.
Offers both exception-based and std::error_code APIs, allowing developers to choose based on their error management preferences, as described in the API Philosophy section.
Uses C++14 features and a parameter-based API that avoids positional arguments, making the code more readable and type-safe, similar to popular JWT libraries in other languages.
Requires OpenSSL (>=1.0.2j), nlohmann JSON, and Google Test for building, which complicates setup and increases project footprint, as noted in the External Dependencies section.
The author admits being bound to nlohmann JSON with no support for other JSON libraries, limiting flexibility in projects with existing JSON dependencies, as mentioned in Things for improvement.
Tested only with specific compiler versions (clang-5.0, g++-6.4, VS2017 with issues) and requires CMake or conan, which may not fit all build systems or older environments.