fix: access sub directly
This commit is contained in:
parent
e9aa676d94
commit
bf65e845f3
|
@ -42,9 +42,9 @@ func AuthMiddleware(handler jape.Handler, portal interfaces.Portal) jape.Handler
|
||||||
}
|
}
|
||||||
|
|
||||||
if claim, ok := token.Claims.(jwt.MapClaims); ok && token.Valid {
|
if claim, ok := token.Claims.(jwt.MapClaims); ok && token.Valid {
|
||||||
subject, err := claim.GetSubject()
|
subject, ok := claim["sub"].(string)
|
||||||
if err != nil {
|
if !ok {
|
||||||
http.Error(w, err.Error(), http.StatusBadRequest)
|
http.Error(w, "Invalid User ID", http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue