Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
jwtauth
✓ github.com/go-chi/jwtauth
Minimal Chi router with JWT authentication middleware.
package main
import (
"net/http"
"github.com/go-chi/chi/v5"
"github.com/go-chi/jwtauth"
)
func main() {
r := chi.NewRouter()
tokenAuth := jwtauth.New("HS256", []byte("secret"), nil)
r.Use(jwtauth.Verifier(tokenAuth))
r.Get("/protected", func(w http.ResponseWriter, r *http.Request) {
_, claims, _ := jwtauth.FromContext(r.Context())
w.Write([]byte("Protected area. claims: %v", claims))
})
http.ListenAndServe(":3000", r)
}
Debug
Known issues
No known issues recorded.
Upgrade
Version history
4.0.4+incompatiblelatest on pkg.go.dev
Audit
Dependencies
No dependency data recorded yet.