Code Room
Code reviewMedium
Question
Review this Go JWT validation helper.
What a strong answer looks like
Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.
Learn the concepts
func parseClaims(tokenStr string, secret []byte) (jwt.MapClaims, error) { token, err := jwt.Parse(tokenStr, func(t *jwt.Token) (interface{}, error) { return secret, nil }) if err != nil { return nil, err } if claims, ok := token.Claims.(jwt.MapClaims); ok && token.Valid { return claims, nil } return nil, errors.New("invalid claims")}Run or narrate your approach, then ask the coach.