fix: string/number hacks

This commit is contained in:
Derrick Hammer 2024-02-12 00:47:29 -05:00
parent 669a6eaf6d
commit 608cfad501
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 8 additions and 2 deletions

View File

@ -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
}