From 26d63cd2338607823dc681e48d4a2cae20f1ef8f Mon Sep 17 00:00:00 2001 From: Livio Spring Date: Fri, 7 Jul 2023 21:04:55 +0200 Subject: [PATCH] fix: handle missing parameters in external provider callback (#6158) --- internal/api/ui/login/external_provider_handler.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/api/ui/login/external_provider_handler.go b/internal/api/ui/login/external_provider_handler.go index 38029ad051..ee7696cc4e 100644 --- a/internal/api/ui/login/external_provider_handler.go +++ b/internal/api/ui/login/external_provider_handler.go @@ -897,6 +897,10 @@ func (l *Login) appendUserGrants(ctx context.Context, userGrants []*domain.UserG } func (l *Login) externalAuthFailed(w http.ResponseWriter, r *http.Request, authReq *domain.AuthRequest, tokens *oidc.Tokens[*oidc.IDTokenClaims], user idp.User, err error) { + if authReq == nil { + l.renderLogin(w, r, authReq, err) + return + } if _, _, actionErr := l.runPostExternalAuthenticationActions(&domain.ExternalUser{}, tokens, authReq, r, user, err); actionErr != nil { logging.WithError(err).Error("both external user authentication and action post authentication failed") }