Skip to content

Commit

Permalink
Trying to fix fiber middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
Shubhrajyoti-Dey-FrosTiK committed Feb 6, 2024
1 parent e70f482 commit a52199a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion handler/fiber-middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package handler

import (
"errors"
"net/http"

"github.com/FrosTiK-SD/auth/constants"
"github.com/FrosTiK-SD/auth/interfaces"
Expand All @@ -12,6 +13,7 @@ import (

// For Gin based middlewares
func (h *Handler) FiberVerifyStudent(ctx *fiber.Ctx) error {
token := ctx.Get("token", "")

// Create a new session
currentHandler := Handler{
Expand All @@ -23,7 +25,13 @@ func (h *Handler) FiberVerifyStudent(ctx *fiber.Ctx) error {
},
}

context := gin.Context{}
context := gin.Context{
Request: &http.Request{
Header: http.Header{
"token": []string{token},
},
},
}

currentHandler.HandlerVerifyStudentIdToken(&context)
student := currentHandler.Session.Student
Expand Down

0 comments on commit a52199a

Please sign in to comment.