Skip to content

Commit

Permalink
update cors
Browse files Browse the repository at this point in the history
Signed-off-by: Rajiv Harlalka <[email protected]>
  • Loading branch information
rajivharlalka committed Aug 27, 2024
1 parent 8268bc4 commit 7c4819c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion backend/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 7c4819c

Please sign in to comment.