Skip to content

Commit

Permalink
fix: add fallback to providerLabel (#3999)
Browse files Browse the repository at this point in the history
This adds a fallback to the provider label when trying to register a duplicate identifier with an oidc.

Current error message:

`Signing in will link your account to "test@test.com" at provider "". If you do not wish to link that account, please start a new login flow.`

The label represents an optional label for the UI, but in my case it's always empty. I suggest we fallback to the provider when the label is not present. In case the label is present, the behaviour won't change.

Fallback to provider:

`Signing in will link your account to "test@test.com" at provider "google". If you do not wish to link that account, please start a new login flow.`
  • Loading branch information
Pedr0Rocha authored Jul 18, 2024
1 parent 3db4256 commit d26f204
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions selfservice/strategy/oidc/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,9 @@ func (s *Strategy) handleError(w http.ResponseWriter, r *http.Request, f flow.Fl
provider, _ := s.provider(r.Context(), r, providerID)
if provider != nil && provider.Config() != nil {
providerLabel = provider.Config().Label
if providerLabel == "" {
providerLabel = provider.Config().Provider
}
}
lf.UI.Messages.Add(text.NewInfoLoginLinkMessage(dc.DuplicateIdentifier, providerLabel, newLoginURL))

Expand Down

0 comments on commit d26f204

Please sign in to comment.