added refresh tocken

This commit is contained in:
Mephimeow
2026-06-12 10:01:21 +00:00
parent 8c3e4b7a5a
commit 130d5d5e3d
10 changed files with 362 additions and 35 deletions
+2 -1
View File
@@ -56,7 +56,7 @@ func main() {
log.Printf("warning: failed to ensure indexes: %v", err)
}
svc := auth.NewService(repo, cfg.JWTSecret, cfg.JWTExpiration)
svc := auth.NewService(repo, cfg.JWTSecret, cfg.JWTExpiration, cfg.JWTRefreshExpiration)
handler := auth.NewHandler(svc)
gin.SetMode(gin.ReleaseMode)
@@ -76,6 +76,7 @@ func main() {
{
api.POST("/register", handler.Register)
api.POST("/login", handler.Login)
api.POST("/refresh", handler.Refresh)
api.GET("/me", auth.AuthMiddleware([]byte(cfg.JWTSecret)), handler.Me)
}