package
0.0.0-20210318024954-d9e4b8ca2e42
Repository: https://github.com/pangpanglabs/goutils.git
Documentation: pkg.go.dev
# README
jwtutil
Getting Started
Init
func init() {
if s := os.Getenv("JWT_SECRET"); s != "" {
jwtutil.SetJwtSecret(s)
}
}
Generate JWT token
token, err := jwtutil.NewToken(map[string]string{
"iss": "account",
"aud": "pangpanglabs",
"username": "jack",
"tenant": "github",
})
Generate JWT token with secret
token, err := jwtutil.NewTokenWithSecret(map[string]string{
"iss": "account",
"aud": "pangpanglabs",
"username": "jack",
"tenant": "github",
}, myJwtSecret)
Extract claim info
claim, err := jwtutil.Extract(token)
Extract claim info with secret
claim, err := jwtutil.Extract(token, secret)
Renew token
newToken, err := jwtutil.Renew(oldToken)
# Functions
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author