go-oauth2 / oauth2

OAuth 2.0 server library for the Go programming language.
https://pkg.go.dev/github.com/go-oauth2/oauth2/v4
MIT License
3.31k stars 563 forks source link

Added an error handler that is invoked before s.redirectError #206

Closed realbucksavage closed 2 years ago

realbucksavage commented 2 years ago

This PR adds a mechanism that can be used to override the default error handling behavior implemented by s.redirectError. The error handler of this mechanism is defined as func(rw http.ResponseWriter, req *server.AuthorizeRequest, error error) error, and can be enabled by passing a non-nil function to SetPreRedirectErrorHandler.