mercredi 28 juin 2017

jwt key is invalid

I am following this example https://www.youtube.com/watch?v=eVlxuST7dCA to make a jwt auth. When I run the code below I get "Key is invalid" error. WHen I try printing tokenString it is empty. The github to this sample is http://ift.tt/2ukAvwZ Why am I getting invalid error?

var privateKey []byte
privateKey, err := ioutil.ReadFile("demo.rsa")

token := jwt.New(jwt.GetSigningMethod("RS256"))
tokenString, err := token.SignedString(privateKey)

fmt.Println("TOKEN:", tokenString)




Aucun commentaire:

Enregistrer un commentaire