discourse/lib/auth
Régis Hanol 0de08e780b
UX: better error message when social login fails (#32772)
This improves the error message(s) displayed when an error happens while
using a social login to log in / sign up into a Discourse community.

Unfortunately, we can't be super precise in the reason behind the error
(it can be the user clicked "cancel" during the authorization phase, or
any of the plethora of other possible errors) because the reason isn't
provided (either for security reasons, or because it's just hard to do
so in a reliable & consistent way accross all social logins).

The best I could do was to

- add the name of the "social login" provider in the error message
- tweak the copy a bit for the different cases handle
- fix the CSS/HTML to match the one used by the main application

In order to show the name of the provider, we use either the "provider"
or the "strategy" query parameter, or use the name of the authenticator
(if it's the only one enabled).

Internal ref - t/153662

---

**BEFORE**


![before](https://github.com/user-attachments/assets/67579a3e-5a61-4e8f-aa72-4dc375547e39)

**AFTER**


![after](https://github.com/user-attachments/assets/954f9c8a-e865-44ff-b1e3-841393a26edf)
2025-05-20 16:22:38 +02:00
..
auth_provider.rb DEV: Remove deprecated AuthProvider attributes (#31443) 2025-02-25 16:40:35 +08:00
authenticator.rb UX: better error message when social login fails (#32772) 2025-05-20 16:22:38 +02:00
current_user_provider.rb DEV: lint against Layout/EmptyLineBetweenDefs (#24914) 2023-12-15 23:46:04 +08:00
default_current_user_provider.rb FIX: Incorrect topic per-minute invitation rate limit (#31252) 2025-02-10 13:12:16 +10:00
discord_authenticator.rb UX: better error message when social login fails (#32772) 2025-05-20 16:22:38 +02:00
facebook_authenticator.rb UX: better error message when social login fails (#32772) 2025-05-20 16:22:38 +02:00
github_authenticator.rb UX: better error message when social login fails (#32772) 2025-05-20 16:22:38 +02:00
google_oauth2_authenticator.rb UX: better error message when social login fails (#32772) 2025-05-20 16:22:38 +02:00
linkedin_oidc_authenticator.rb UX: better error message when social login fails (#32772) 2025-05-20 16:22:38 +02:00
managed_authenticator.rb FIX: Do not schedule avatar download if image is '' (#27687) 2024-07-03 19:50:31 +08:00
oauth_faraday_formatter.rb DEV: Include a basic oauth faraday formatter in core for usage in managed authenticators (#28758) 2024-09-05 22:29:29 +08:00
result.rb DEV: Add code comments around oauth user-api-key/new handling (#31774) 2025-03-12 14:01:20 -04:00
twitter_authenticator.rb UX: better error message when social login fails (#32772) 2025-05-20 16:22:38 +02:00