gitea.tea/modules
Daniel Bankmann b11d991d1e fix(oauth): pass resolved redirect_uri to token exchange (#1019)
When --redirect-url is omitted, the local callback listener binds to a
free port and opts.RedirectURL is rewritten with it. oauth2Config.RedirectURL
was never updated, so Exchange() sent the stale http://127.0.0.1:0 while
the authorize step had sent the real port. RFC-6749-compliant servers
(Gitea >= #37704, current Forgejo) reject the mismatch.

Propagate the resolved URL back into oauth2Config before Exchange. Add a
regression test using httptest that drives the flow end-to-end and asserts
the redirect_uri values match.

---------

Co-authored-by: dbankmann <204984+dbankmann@users.noreply.gitea.com>
Reviewed-on: https://gitea.com/gitea/tea/pulls/1019
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Daniel Bankmann <204984+dbankmann@noreply.gitea.com>
Co-committed-by: Daniel Bankmann <204984+dbankmann@noreply.gitea.com>
2026-06-20 20:03:34 +00:00
..
api update import path to use gitea.dev (#1003) 2026-05-23 17:26:43 +00:00
auth fix(oauth): pass resolved redirect_uri to token exchange (#1019) 2026-06-20 20:03:34 +00:00
config Move sdk from code.gitea.io/sdk/gitea to gitea.dev/sdk (#1006) 2026-05-26 04:51:09 +00:00
context fix(context): improve local repo detection logic and test (#999) 2026-05-25 22:12:19 +00:00
debug add debug mode and update readme (#805) 2025-09-10 19:10:02 +00:00
filelock Move versions/filelocker into dedicated subpackages, and consistent headers in http requests (#888) 2026-02-05 18:05:43 +00:00
git Use git command instead of go git (#1005) 2026-05-23 20:24:47 +00:00
httputil update import path to use gitea.dev (#1003) 2026-05-23 17:26:43 +00:00
interact Move sdk from code.gitea.io/sdk/gitea to gitea.dev/sdk (#1006) 2026-05-26 04:51:09 +00:00
print feat(pulls): show PR URL in detail view (#1036) 2026-06-15 20:35:21 +00:00
task feat(pulls): show PR URL in detail view (#1036) 2026-06-15 20:35:21 +00:00
theme feat: store OAuth tokens in OS keyring via credstore (#926) 2026-03-12 02:49:14 +00:00
utils feat(pulls): add --draft to create and --draft/--ready to edit (#1008) 2026-05-31 02:50:32 +00:00
version Move versions/filelocker into dedicated subpackages, and consistent headers in http requests (#888) 2026-02-05 18:05:43 +00:00