Skip to content

Commit

Permalink
parse jwt token error in handler vmware-archive#73
Browse files Browse the repository at this point in the history
  • Loading branch information
u5surf committed Oct 24, 2018
1 parent 481502a commit 90afd45
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cmd/gangway/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,15 @@ func callbackHandler(w http.ResponseWriter, r *http.Request) {
}

func parseToken(idToken string) (*jwt.Token, error) {
token, _ := jwt.Parse(idToken, func(token *jwt.Token) (interface{}, error) {
token, err := jwt.Parse(idToken, func(token *jwt.Token) (interface{}, error) {
if _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {
return nil, fmt.Errorf("There was an error")
return nil, fmt.Errorf("Unexpected signing method")
}
return []byte(cfg.ClientSecret), nil
})
if err != nil {
return nil, err
}
return token, nil
}

Expand Down

0 comments on commit 90afd45

Please sign in to comment.