forgejo/routers/web/auth
Gusted 1c64bad453 fix: improve OAuth2 experience (#11715)
- fix: show oauth2 retrieve error
  - `true` indicates it only should be shown when the page is rendered
directly via `ctx.HTML` and not propagated if it redirects. As you can
see this always redirects and means the error is not shown.
  - Has the funny behavior that you get redirected to `/user/login`
without any indication what went wrong, no errors in the logs either.
- fix: pre-process OAuth2 client ID and secret
  - Spaces should are not appropriate for these input, remove them.
  - Manually copying and pasting client ID and secret from Github OAuth2
applications seems prone to introduce whitespaces.
  - The error of having a incorrect client ID is more noticeable (404 page
for the user).
  - The error of having a incorrect client secret is not noticeable (404
page for the goth library but no mention it's the wrong secret).

Reported-by: marijnh
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/11715
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org>
Reviewed-by: Andreas Ahlenstorf <aahlenst@noreply.codeberg.org>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
2026-03-17 18:44:23 +01:00
..
2fa.go fix: do 2FA on OpenID connect 2025-08-30 09:41:20 +02:00
auth.go chore: refactor signup logic (#10915) 2026-01-26 22:55:30 +01:00
auth_test.go chore: refactor signup logic (#10915) 2026-01-26 22:55:30 +01:00
linkaccount.go chore: add email blocklist unit test 2025-08-30 09:45:19 +02:00
main_test.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
oauth.go fix: improve OAuth2 experience (#11715) 2026-03-17 18:44:23 +01:00
oauth_test.go chore: do not pass the full signing key to template (#10967) 2026-01-26 14:47:48 +01:00
openid.go chore: unify the usage of CryptoRandomString (#10110) 2025-11-15 13:24:53 +01:00
password.go fix: allow unactivated users to send recovery mails (#9504) 2025-10-03 07:16:24 +02:00
webauthn.go fix: do 2FA on OpenID connect 2025-08-30 09:41:20 +02:00