Skip to content

Commit

Permalink
fix: redirect client back to base URL incase of error
Browse files Browse the repository at this point in the history
  • Loading branch information
lsjostro committed Sep 2, 2024
1 parent ac81d9d commit 9989e24
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions authz/authz.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,9 @@ func (s *Service) authProcess(ctx context.Context, req *auth.AttributeContext_Ht
// and request against the idp will be retried, which means less
// confusing for the user.
if strings.HasPrefix(err.Error(), `oauth2: "invalid_grant"`) {
// Redirect the client back to the base URL
baseUrl, _ := url.Parse(provider.CallbackURI)
sessionData.RequestedUrl = baseUrl.Scheme + "://" + baseUrl.Host
slog.Error("Invalid grant",
slog.String("err", err.Error()),
slog.String("url", requestedURL),
Expand Down

0 comments on commit 9989e24

Please sign in to comment.