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.
jwt
✓ github.com/dgrijalva/jwt-go/v4
Creates a signed JWT token using HMAC-SHA256.
package main
import (
"fmt"
"github.com/dgrijalva/jwt-go/v4"
)
func main() {
token := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{
"foo": "bar",
})
tokenString, err := token.SignedString([]byte("secret"))
if err != nil {
panic(err)
}
fmt.Println(tokenString)
}
Debug
Known issues
breakingThis is a preview version (v4.0.0-preview1) and may have breaking changes before stable release.fixUse the stable v3.x series or wait for v4 final release.
affects: >=4.0.0-preview1 <4.0.0
Upgrade
Version history
4.0.0-preview1latest on pkg.go.dev
Audit
Dependencies
No dependency data recorded yet.