mirror of https://github.com/golang-jwt/jwt.git
Merge pull request #151 from zaichang/FixMigrationGuide
Fixed migration guide request.ParseFromRequest example code
This commit is contained in:
commit
63734eae1e
|
@ -56,8 +56,9 @@ This simple parsing example:
|
||||||
is directly mapped to:
|
is directly mapped to:
|
||||||
|
|
||||||
```go
|
```go
|
||||||
if token, err := request.ParseFromRequest(tokenString, request.OAuth2Extractor, req, keyLookupFunc); err == nil {
|
if token, err := request.ParseFromRequest(req, request.OAuth2Extractor, keyLookupFunc); err == nil {
|
||||||
fmt.Printf("Token for user %v expires %v", token.Claims["user"], token.Claims["exp"])
|
claims := token.Claims.(jwt.MapClaims)
|
||||||
|
fmt.Printf("Token for user %v expires %v", claims["user"], claims["exp"])
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue