paulish / jwt

JSON Web Tokens for Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jwt

Build Status GoDoc Go Report Card Coverage

JSON Web Tokens for Go

Features

  • Simple API.
  • Optimized for speed.
  • Dependency-free.

Install

Go version 1.13

go get github.com/cristalhq/jwt

Example

signer := jwt.NewHS256([]byte(`secret`))
builder := jwt.NewTokenBuilder(signer)

claims := &jwt.StandardClaims{
    Audience: []string{"admin"},
    ID:       "random-unique-string",
}
token, _ := builder.Build(claims)

raw := token.Raw() // JWT signed token

Documentation

See these docs.

License

MIT License.

About

JSON Web Tokens for Go

License:MIT License


Languages

Language:Go 100.0%