From b08784ba5a75b9aad632ed9419326e4f5d7006b7 Mon Sep 17 00:00:00 2001 From: James White Date: Wed, 4 Jan 2017 11:40:11 +0000 Subject: [PATCH] Clarify hmacSampleSecret type From looking at the godoc for this (https://godoc.org/github.com/dgrijalva/jwt-go#example-Parse--Hmac) it isn't clear what the type of hmacSampleSecret should be as you can't see the rest of this file. I ended up having to search through the code to figure out it needed to be a byte array. --- hmac_example_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hmac_example_test.go b/hmac_example_test.go index 8fb5678..0027831 100644 --- a/hmac_example_test.go +++ b/hmac_example_test.go @@ -51,6 +51,8 @@ func ExampleParse_hmac() { if _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok { return nil, fmt.Errorf("Unexpected signing method: %v", token.Header["alg"]) } + + // hmacSampleSecret is a []byte containing your secret, e.g. []byte("my_secret_key") return hmacSampleSecret, nil })