Registry / auth / auth0-go-jwt-middleware

auth0-go-jwt-middleware

JSON →
library1.0.1gogounverified

A middleware for validating JWT tokens in HTTP requests.

go get github.com/auth0/go-jwt-middleware
INSTALL
IMPORT
SIG · AUTH0-GO-JWT-MIDDL
A
auth0-go-jwt-middleware
authgov1.0.1
harness data pending
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.

jwtmiddleware
github.com/auth0/go-jwt-middleware

Sets up a JWT middleware that protects an HTTP endpoint.

package main import ( "net/http" "github.com/auth0/go-jwt-middleware" ) func main() { middleware := jwtmiddleware.New(jwtmiddleware.Options{ ValidationKeyGetter: func(token *jwt.Token) (interface{}, error) { return []byte("secret"), nil }, }) http.Handle("/protected", middleware.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Write([]byte("OK")) }))) }
Debug
Known issues
gotchaVersion 1.x uses the deprecated dgrijalva/jwt-go library; consider migrating to golang-jwt/jwt.
fix
Use github.com/auth0/go-jwt-middleware/v2 which supports golang-jwt/jwt.
affects: >=1.0.0 <2.0.0
Upgrade
Version history
1.0.1latest on pkg.go.dev
Audit
Dependencies

No dependency data recorded yet.

Agent activity
27 hits · last 30 days
node
24
Resources
auth0-go-jwt-middleware — go get auth0-go-jwt-middleware · libregistry