dgrijalva/jwt-go

Why `jwt.ParseWithClaims` treat an uint number as float64?

donkw opened this issue · 1 comments

donkw commented

claims := jwt.MapClaims{}
token, err := jwt.ParseWithClaims(tokenString, claims, func(token *jwt.Token) (interface{}, error) {
return j.AccessTokenSigningKey, nil
}
fmt.Printf("uint number: %+v\n", claims["uintnum"]) // out: 9.6863578e+07

uintNum := claims["uintnum"].(uint) // panic
fmt.Printf("uint number: %+v\n", uintNum )

This will panic: interface conversion: interface {} is float64, not uint, but the value of uintnum is an uint number.
How could i get uint number from claims ?