Skip to content

Commit

Permalink
fix: oauth2 invaild grant has no error type in x/oauth2 package
Browse files Browse the repository at this point in the history
  • Loading branch information
lsjostro committed Aug 29, 2024
1 parent 76b99ef commit a712d17
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions authz/authz.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"connectrpc.com/otelconnect"
cache_store "github.com/eko/gocache/lib/v4/store"
"github.com/gogo/googleapis/google/rpc"
"github.com/zitadel/oidc/v3/pkg/oidc"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/codes"
Expand Down Expand Up @@ -237,7 +236,7 @@ func (s *Service) authProcess(ctx context.Context, req *auth.AttributeContext_Ht
// This will redirect the client back to the first requested URL
// and request against the idp will be retried, which means less
// confusing for the user.
if err == oidc.ErrInvalidGrant() {
if strings.HasPrefix(err.Error(), `oauth2: "invalid_grant"`) {
slog.Error("Invalid grant", slog.String("url", requestedURL), slog.String("err", err.Error()))
} else {
return nil, err
Expand Down

0 comments on commit a712d17

Please sign in to comment.