Package jwt is a JSON Web Token signer, verifier and validator.
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.
github.com/gbrlsnchs/jwt/v3
Signs a JWT token with HS256.
package main
import (
"fmt"
"github.com/gbrlsnchs/jwt/v3"
)
func main() {
payload := jwt.Payload{
Subject: "user123",
}
token, err := jwt.Sign(payload, jwt.NewHS256([]byte("secret")))
if err != nil {
panic(err)
}
fmt.Println(string(token))
}
Debug
Known footguns
No known footguns recorded.
Upgrade
Version history
Breaking-change detection hasn't run for this library yet.
Audit
Security & dependencies
CVE tracking and dependency tree are planned for a later release.