Skip to content

Commit

Permalink
Clarify hmacSampleSecret type
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jamesrwhite authored Jan 4, 2017
1 parent 9ed569b commit b08784b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions hmac_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
})

Expand Down

0 comments on commit b08784b

Please sign in to comment.