experiment some thing spicy

This commit is contained in:
Kenta420 2023-12-01 11:14:25 +07:00
parent ce28a757b1
commit 3411ae333d
18 changed files with 211 additions and 10 deletions

View file

@ -10,6 +10,7 @@ import (
"recipe-manager/services/oauth"
"github.com/go-chi/chi/v5"
"go.uber.org/zap"
"golang.org/x/oauth2"
)
@ -87,6 +88,8 @@ func (ar *AuthRouter) Route(r chi.Router) {
value.Add("redirect_to", redirect_to)
}
Log.Info("User Log-In Success", zap.String("user", user.Name), zap.String("email", user.Email))
// redirect to frontend with token and refresh token
w.Header().Add("set-cookie", "access_token="+token.AccessToken+"; Path=/; HttpOnly; SameSite=None; Secure; Max-Age=3600")
w.Header().Add("set-cookie", "refresh_token="+token.RefreshToken+"; Path=/; HttpOnly; SameSite=None; Secure")