jwt

A zero-dependency Go implementation of JSON Web Tokens (JWT) with pluggable HMAC, RSA, RSA-PSS, ECDSA, and Ed25519 signing methods.

Library
Go
vv5.3.1
9,201stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
66/100Good
Development Activity56
Maintenance48
Community60
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
83/100Excellent
Architecture80
Code Quality85
Innovation80
Learning Curve85

golang-jwt/jwt is the community-maintained continuation of the original dgrijalva/jwt-go, implementing the JSON Web Token standard (RFC 7519) for Go applications. It provides a Token type and Parser for creating, signing, and verifying JWTs, with a pluggable SigningMethod registry that ships HMAC-SHA, RSA, RSA-PSS, ECDSA, and EdDSA/Ed25519 out of the box.

Beyond signature verification, the library includes a dedicated Validator for checking expiration, not-before, issued-at, audience, issuer, and subject claims, plus support for fully custom claim types via the Claims interface. A companion request sub-package adds extractors for pulling tokens out of HTTP headers, query parameters, and OAuth2-style forms, making it a complete building block for stateless authentication in Go services.

What You Get

  • A Token type plus New/NewWithClaims/Parse/ParseWithClaims functions for building and verifying JWTs
  • Built-in signing methods for HMAC-SHA (HS256/384/512), RSA and RSA-PSS, ECDSA, and EdDSA/Ed25519 behind a common SigningMethod interface
  • A validation API (Validator, ParserOptions) for expiration, not-before, issued-at, audience, issuer, and subject claim checks with configurable leeway
  • MapClaims and RegisteredClaims implementations of the Claims interface, with support for fully custom claim types
  • A request sub-package with extractors for pulling tokens out of HTTP headers, query params, and OAuth2-style forms

Common Use Cases

  • Issuing and verifying bearer tokens for stateless API authentication
  • Implementing OAuth2-style access tokens for a Go backend service
  • Validating third-party JWTs (e.g. from an identity provider) before trusting their claims
  • Embedding custom application claims (roles, tenant IDs) in a signed token passed between services

Under The Hood

Architecture - A Token struct holds Raw/Method/Header/Claims/Signature/Valid. New/NewWithClaims build a Token; SignedString computes the signing string (base64url-encoded JSON header and claims joined by ’.’), calls Method.Sign to produce a signature, and appends it. Parsing flows through Parse/ParseWithClaims into ParseUnverified, which splits the token into three segments, base64-decodes header/claims/signature, and resolves the SigningMethod from the header’s alg via a global registry. ParseWithClaims then checks the method against an optional allow-list, invokes the caller-supplied Keyfunc to obtain a verification key (a single key or a VerificationKeySet for key rotation), calls Method.Verify, and runs Validator.Validate for claim checks (exp/nbf/iat/aud/iss/sub) unless skipped. SigningMethod is a minimal interface (Sign/Verify/Alg) backed by a registry map guarded by sync.RWMutex, populated via init() in each algorithm file, letting third parties register new algorithms without touching core code. A request sub-package layers pluggable Extractors on top for pulling raw tokens out of *http.Request.

Tech Stack - Pure Go standard library: go.mod declares module github.com/golang-jwt/jwt/v5 at go 1.21 with an empty go.sum (zero third-party dependencies). It relies solely on crypto, crypto/hmac, crypto/rsa, crypto/ecdsa, crypto/ed25519, encoding/base64, encoding/json, and slices/errors from stdlib, with GitHub Actions driving CI. This zero-dependency, stdlib-only design is a deliberate strength for a security-sensitive library, minimizing supply-chain surface area.

Code Quality - 19 _test.go files against 27 non-test .go files, covering nearly every signing algorithm plus parser and validator logic (parser_test.go alone runs to 36KB), with example_test.go and http_example_test.go serving as executable documentation. Errors are modeled as sentinel vars wrapped through a custom newError/joinedError helper supporting Go 1.20+ multi-error %w wrapping compatible with errors.Is/As, rather than ad hoc string errors. Naming is idiomatic and consistent, and doc comments are extensive with links to the project’s usage guide.

API Design - Getting started is a two-line NewWithClaims(…).SignedString(key) / Parse(token, keyFunc) pair with sane MapClaims defaults, while ParserOption functional options and the Keyfunc callback pattern (including VerificationKeySet for rotation) allow full customization. Doc comments proactively flag security footguns directly on exported functions - e.g. always validating alg and avoiding low-entropy HMAC secrets - which is a strong signal for a cryptography-adjacent library. The one notable friction point is a documented pointer/allocation caveat when embedding RegisteredClaims in custom claim types.

Used by 46 apps in this directory

Rust
64%
Apache 2.0

agentgateway

AI Development · Developer Tools

4,420

An open source AI-native proxy that secures, observes, and governs agent-to-LLM, agent-to-tool, and agent-to-agent communication through MCP, A2A, and unified LLM routing.

View details
88
Repo Health
82
Technical
72
Dependency
Built with
Rust64%
Go24%
Updated yesterday
Python
90%
Apache 2.0

Apache Airflow

Data Engineering

46,530

Define, schedule, and monitor complex data workflows as Python code — with a powerful UI, 80+ provider integrations, and battle-tested scalability across thousands of production deployments.

View details
96
Repo Health
89
Technical
66
Dependency
Built with
Python90%
Updated today
Go
86%
Apache 2.0

Authelia

Security · Authentication

28,626

OpenID Certified SSO and MFA portal for securing self-hosted web applications behind reverse proxies.

View details
91
Repo Health
81
Technical
77
Dependency
Built with
Go86%
TypeScript12%
Updated today
Python
54%
Other

authentik

Authentication · Security

24,980

The self-hosted Identity Provider that replaces Okta, Auth0, and Entra ID with a unified SSO platform supporting SAML, OAuth2/OIDC, LDAP, RADIUS, and WebAuthn.

View details
92
Repo Health
81
Technical
68
Dependency
Built with
Python54%
TypeScript33%
Updated today
Go
92%
AGPL 3.0

BillionMail

Marketing

15,424

Self-hosted email server and marketing platform that gives you unlimited sending, full deliverability control, and AI-assisted campaigns without monthly fees.

View details
59
Repo Health
74
Technical
73
Dependency
Built with
Go92%
Updated 2 months ago
Go
52%
MIT

Bytebase

Devops

14,396

An open-source database CI/CD and DevSecOps platform — schema migration review, GitOps-driven changes, data masking, and access control across MySQL, PostgreSQL, Oracle, Snowflake, MongoDB, and more.

View details
92
Repo Health
73
Technical
69
Dependency
Built with
Go52%
TypeScript39%
Updated today
Go
72%
Other

Convoy

Developer Tools · Devops

2,858

Convoy is an open-source, cloud-native webhooks gateway that ingests events over HTTP or straight from Kafka, SQS, Google Pub/Sub, and RabbitMQ, then reliably delivers them to subscriber endpoints with signed payloads, automatic retries, circuit breaking, and JavaScript-based transformations.

View details
89
Repo Health
81
Technical
68
Dependency
Built with
Go72%
TypeScript14%
HTML13%
Updated yesterday
Go
92%
AGPL 3.0

Cozy Stack

File Storage · Productivity

1,272

Self-hosted personal cloud platform that unifies your files, apps, and devices in one private space you fully control.

View details
92
Repo Health
77
Technical
72
Dependency
Built with
Go92%
Updated 2 weeks ago
Go
32%
Apache 2.0

CubeSandbox

Developer Tools · Security · AI Agents

11,247

Instant, concurrent, hardware-isolated MicroVM sandboxes for AI agents — E2B-API compatible, sub-60ms cold starts, and a built-in zero-trust egress proxy, all self-hostable at scale.

View details
83
Repo Health
88
Technical
63
Dependency
Built with
Go32%
Rust31%
C21%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search