Skip to content

Commit

Permalink
Fix padded jwt throwing invalid char error
Browse files Browse the repository at this point in the history
  • Loading branch information
Tharsanan1 committed Oct 25, 2024
1 parent ec646e4 commit 16ea1f1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion common-controller/internal/web/notify_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@ func extractClaimsFromJWT(jwtToken string) (jWTClaims, error) {
loggers.LoggerAPI.ErrorC(logging.PrintError(logging.Error3205, logging.MAJOR, "Invalid JWT"))
return claims, fmt.Errorf("Invalid JWT token")
}
payload, err := base64.RawURLEncoding.DecodeString(parts[1])
payloadStr := strings.TrimRight(parts[1], "=")
payload, err := base64.RawURLEncoding.DecodeString(payloadStr)
if err != nil {
loggers.LoggerAPI.ErrorC(logging.PrintError(logging.Error3205, logging.MAJOR, "Invalid JWT"))
return claims, fmt.Errorf("Error decoding payload: %v", err)
Expand Down

0 comments on commit 16ea1f1

Please sign in to comment.