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,251 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
68 /100 Good
Development Activity 64
Maintenance 48
Community 60
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
83 /100 Excellent
Architecture 80
Code Quality 85
Innovation 80
Learning Curve 85

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 66 apps in this directory

Ruby
66%
Other

GitLab

Developer Tools · Devops

24,537

The complete DevOps platform that unifies Git hosting, CI/CD, issue tracking, and security scanning into a single self-hostable application.

View details
87
Repo Health
86
Technical
65
Dependency
Built with
Ruby 66%
JavaScript 20%
Updated 1 weeks ago
TypeScript
47%
AGPL 3.0

Grafana

Analytics · Monitoring

77,469

The open-source observability platform that unifies metrics, logs, and traces from any data source into dynamic, queryable dashboards.

View details
95
Repo Health
91
Technical
63
Dependency
Built with
TypeScript 47%
Go 47%
Updated 1 weeks ago
Go
62%
Apache 2.0

Harness Open Source

Code Editors · Developer Tools · Devops

38,684

A unified open source DevOps platform combining Git hosting, CI/CD pipelines, cloud development environments, and artifact registries in a single self-hosted system.

View details
90
Repo Health
79
Technical
64
Dependency
Built with
Go 62%
TypeScript 33%
Updated 1 weeks ago
TypeScript
71%
Other

highlight.io

Analytics · Developer Tools · Monitoring

9,384

Open-source full-stack monitoring that unifies session replay, error tracking, logging, and distributed tracing so you can stop context-switching between tools.

View details
76
Repo Health
78
Technical
65
Dependency
Built with
TypeScript 71%
Go 16%
Updated 1 weeks ago
TypeScript
71%
Other

highlight.io

Analytics · Developer Tools · Monitoring

9,384

Open-source full-stack monitoring that unifies session replay, error tracking, logging, and distributed tracing so you can stop context-switching between tools.

View details
76
Repo Health
78
Technical
65
Dependency
Built with
TypeScript 71%
Go 16%
Updated 1 weeks ago
Go
69%
MIT

hoop

Monitoring · Security

836

A wire-protocol gateway that enforces data masking, command blocking, approval workflows, and full session recording for engineers and AI agents accessing production infrastructure.

View details
86
Repo Health
80
Technical
64
Dependency
Built with
Go 69%
Clojure 13%
Updated 1 weeks ago
TypeScript
62%
EPL-2.0

Huly Platform

Collaboration · Project Management · Team Chat

27,978

Open-source all-in-one workspace that replaces Linear, Jira, Slack, and Notion for product and engineering teams.

View details
90
Repo Health
86
Technical
62
Dependency
Built with
TypeScript 62%
Svelte 34%
Updated 1 weeks ago
TypeScript
96%
Other

Infisical

Devops · Security

29,961

The open-source platform for secrets, certificates, privileged access, and AI agent security — all in one self-hostable system.

View details
91
Repo Health
84
Technical
64
Dependency
Built with
TypeScript 96%
Updated 1 weeks ago
Go
97%
Apache 2.0

kopia

File Storage

14,417

Fast, encrypted, deduplicated backups to any cloud or local storage with full client-side control.

View details
90
Repo Health
83
Technical
68
Dependency
Built with
Go 97%
Updated 1 weeks ago

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