From 7c4819cdb53362b9d1b21e2650b81292b476b1a9 Mon Sep 17 00:00:00 2001 From: Rajiv Harlalka Date: Tue, 27 Aug 2024 19:57:41 +0530 Subject: [PATCH] update cors Signed-off-by: Rajiv Harlalka --- backend/main.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/main.go b/backend/main.go index f76dd15b..017273ad 100644 --- a/backend/main.go +++ b/backend/main.go @@ -494,6 +494,7 @@ func JWTMiddleware(handler http.Handler) http.Handler { } JWTtoken := strings.Split(tokenString, " ") + fmt.Println(JWTtoken) if len(JWTtoken) != 2 { w.WriteHeader(http.StatusBadRequest) fmt.Fprint(w, "Authorisation head is of incorrect type") @@ -599,7 +600,10 @@ func main() { http.Handle("GET /unapproved", JWTMiddleware(http.HandlerFunc(listUnapprovedPapers))) c := cors.New(cors.Options{ - AllowedOrigins: []string{"https://qp.metakgp.org", "http://localhost:3000"}, + AllowCredentials: true, + AllowedHeaders: []string{"*"}, + AllowedMethods: []string{"GET", "POST", "PUT", "DELETE"}, + AllowedOrigins: []string{"https://qp.metakgp.org", "http://localhost:3000"}, }) fmt.Println("Starting server on port 5000")