This commit is contained in:
ston1th 2025-10-15 22:22:11 +02:00
commit 824f46979b
6 changed files with 69 additions and 103 deletions

View file

@ -57,11 +57,11 @@ func (s *HTTPServer) Start() (err error) {
if err != nil {
return
}
opts := []jwt.JWTOption{jwt.WithBlacklist(s.DB), jwt.WithNonce()}
if s.Config.Secret != "" {
s.JWT, err = jwt.New(jwt.DefaultExpiry, s.DB, bytes.NewBufferString(s.Config.Secret))
} else {
s.JWT, err = jwt.New(jwt.DefaultExpiry, s.DB, nil)
opts = append(opts, jwt.WithSecret(bytes.NewBufferString(s.Config.Secret)))
}
s.JWT, err = jwt.New(opts...)
if err != nil {
return errors.New("server: " + err.Error())
}