Skip to content

Commit

Permalink
remove redefinition of providedCodeVerifier, fixed spelling (#6)
Browse files Browse the repository at this point in the history
Signed-off-by: Bernd Eckstein <[email protected]>
Signed-off-by: Bernd Eckstein <[email protected]>
  • Loading branch information
HEllRZA committed Sep 16, 2020
1 parent 369674f commit a1aab00
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 0 additions & 2 deletions server/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -816,13 +816,11 @@ func (s *Server) handleAuthCode(w http.ResponseWriter, r *http.Request, client s
providedCodeVerifier := r.PostFormValue("code_verifier")

if providedCodeVerifier != "" && codeChallengeFromStorage != "" {
providedCodeVerifier := r.PostFormValue("code_verifier")
calculatedCodeChallenge, err := s.calculateCodeChallenge(providedCodeVerifier, authCode.CodeChallenge.CodeChallengeMethod)
if err != nil {
s.tokenErrHelper(w, errServerError, "", http.StatusInternalServerError)
return
}

if codeChallengeFromStorage != calculatedCodeChallenge {
s.tokenErrHelper(w, errInvalidGrant, "Invalid code_verifier.", http.StatusBadRequest)
return
Expand Down
2 changes: 1 addition & 1 deletion server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1332,7 +1332,7 @@ func checkErrorResponse(err error, t *testing.T, tc test) {
tc.name, details.Error, details.ErrorDescription, tc.tokenError.Error)
}
} else {
t.Errorf("%s: unexpedted error type: %s. expected *oauth2.RetrieveError", tc.name, reflect.TypeOf(err))
t.Errorf("%s: unexpected error type: %s. expected *oauth2.RetrieveError", tc.name, reflect.TypeOf(err))
}
}

Expand Down

0 comments on commit a1aab00

Please sign in to comment.