From 608cfad5012029b7334b78db2f56f3d3d566318c Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Mon, 12 Feb 2024 00:47:29 -0500 Subject: [PATCH] fix: string/number hacks --- api/middleware.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/api/middleware.go b/api/middleware.go index f449847..3207395 100644 --- a/api/middleware.go +++ b/api/middleware.go @@ -87,8 +87,14 @@ func githubRestVerifyMiddleware(db *gorm.DB) mux.MiddlewareFunc { return } - appId, ok := claims["iss"].(string) - if !ok { + var appId string + + switch v := claims["iss"].(type) { + case string: + appId = v + case float64: + appId = strconv.FormatFloat(v, 'f', -1, 64) + default: http.Error(w, "Invalid JWT", http.StatusUnauthorized) return }