Add a way to use a JWT in an HTTP only cookie

If a JWT is not included in the Authorization header or a query string, attempt to get a JWT from an HTTP only cookie.
This commit is contained in:
jerebear12 2023-12-04 14:02:45 -06:00 committed by Chris Lu
parent 4aeca48b6d
commit d5d9fbb8aa

View file

@ -83,6 +83,14 @@ func GetJwt(r *http.Request) EncodedJwt {
}
}
// Get token from http only cookie
if tokenStr == "" {
token, err := r.Cookie("AT")
if err == nil {
tokenStr = token.Value
}
}
return EncodedJwt(tokenStr)
}