kataras/jwt

payload is not a type of JSON error

stasandk opened this issue · 0 comments

Hi there, I'm having some issues with Verify func. The following throws an error of: payload is not a type of JSON. I don't see anything wrong with that token. Could be this a bug?

package main

import (
  "fmt"
  "github.com/kataras/jwt"
)

func main() {
  secret := "secret"
  token := "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOjEyMywibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.QzFnWiase0tPyeNzn8ecl-kVfDVEZ1ctbf9ztM0Qjqg"

  _, err := jwt.Verify(jwt.HS256, []byte(secret), []byte(token))
	if err != nil {
		fmt.Printf("JWT verify error: %v", err)
		return
	}

  fmt.Println("Verified")
}