From 40b65a401909645b95eaa5b26645ed2e936b5ad1 Mon Sep 17 00:00:00 2001 From: bel Date: Sun, 20 Oct 2019 13:14:18 -0600 Subject: [PATCH] Redirect aint perfect and username only --- oauth2client/client.go | 6 ++++-- oauth2server/server/authorize.go | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/oauth2client/client.go b/oauth2client/client.go index 433fa17..1b270b3 100644 --- a/oauth2client/client.go +++ b/oauth2client/client.go @@ -30,8 +30,10 @@ func login(oauth2server *url.URL, w http.ResponseWriter, r *http.Request) error url.Scheme = "http" } cookie := &http.Cookie{ - Name: oauth2.REDIRECT, - Value: url.String(), + Name: oauth2.REDIRECT, + Value: url.String(), + SameSite: http.SameSiteLaxMode, + Path: "/authorize", } http.SetCookie(w, cookie) http.Redirect(w, r, oauth2server.String(), http.StatusSeeOther) diff --git a/oauth2server/server/authorize.go b/oauth2server/server/authorize.go index a416dde..bb4eb3e 100644 --- a/oauth2server/server/authorize.go +++ b/oauth2server/server/authorize.go @@ -3,6 +3,7 @@ package server import ( "local/oauth2" "local/storage" + "log" "net/http" "github.com/google/uuid" @@ -31,6 +32,8 @@ func (s *Server) authorize(w http.ResponseWriter, r *http.Request) { } http.SetCookie(w, cookie) redirectCookie, err := r.Cookie(oauth2.REDIRECT) + log.Printf("REDIR COOKIE", err, redirectCookie) + log.Println(r.Cookies()) if err != nil { return }