Commit ba426888 authored by Porjo's avatar Porjo Committed by Dave Grijalva

gofmt README examples

Conflicts:
	README.md
parent f80fd394
......@@ -5,20 +5,25 @@ This library supports the parsing and verification as well as the generation and
This library is considered production ready. Feedback and feature requests are appreciated.
## Parse and Verify
token, err := jwt.Parse(myToken, func(token *jwt.Token)([]byte, error){
return myLookupKey(token.Head["kid"])
```go
token, err := jwt.Parse(myToken, func(token *jwt.Token) ([]byte, error) {
return myLookupKey(token.Header["kid"])
})
if !err && token.Valid {
deliverGoodness("!")
} else {
deliverUtterRejection(":(")
}
```
## Create a token
token := jwt.New(jwt.GetSigningMethod("HS256"))
```go
token, _ := jwt.New(jwt.GetSigningMethod("HS256"))
token.Claims["foo"] = "bar"
token.Claims["exp"] = time.Now().Add(time.Hour * 72).Unix()
tokenString, err := token.SignedString(mySigningKey)
```
Documentation can be found [here](http://godoc.org/github.com/dgrijalva/jwt-go)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment