MCPcopy Index your code
hub / github.com/devpew/Muffin-REST-API / GenerateJWT

Function GenerateJWT

main.go:245–261  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

243}
244
245func GenerateJWT() (string, error) {
246 token := jwt.New(jwt.SigningMethodHS256)
247
248 claims := token.Claims.(jwt.MapClaims)
249
250 claims["authorized"] = true
251 claims["user"] = "Elliot Forbes"
252 claims["exp"] = time.Now().Add(time.Hour * 2160).Unix()
253
254 tokenString, err := token.SignedString(mySigningKey)
255
256 if err != nil {
257 fmt.Errorf("Something went wrong: %s", err.Error())
258 }
259
260 return tokenString, nil
261}

Callers 1

checkLoginFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected