Error 500 with Oauth2 and DISABLE_REGISTRATION #2667

Open
opened 2025-11-02 04:43:55 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @camlafit on GitHub (Dec 15, 2018).

  • Gitea version (or commit ref): 1.5.3
  • Git version:
  • Operating system: Debian stretch
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:
    2018/12/15 16:39:24 [...routers/user/auth.go:541 handleOAuth2SignIn()] [E] UserSignIn: could not find a matching session for this request

Description

If new registration is disbled and external connection allowed, we get a 500 error on callback url.
Workaround is to set on provider https://gitea/user/oauth2/[AuthnName] without callback part
or enable registration

Should be nice to redirect to association page to link oauth account with existing

Screenshots

Originally created by @camlafit on GitHub (Dec 15, 2018). <!-- 1. Please speak English, this is the language all of us can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/NsatcWJ) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 1.5.3 - Git version: - Operating system: Debian stretch - Database (use `[x]`): - [ ] PostgreSQL - [x] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant - Log gist: 2018/12/15 16:39:24 [...routers/user/auth.go:541 handleOAuth2SignIn()] [E] UserSignIn: could not find a matching session for this request ## Description If new registration is disbled and external connection allowed, we get a 500 error on callback url. Workaround is to set on provider https://gitea/user/oauth2/[AuthnName] without callback part or enable registration Should be nice to redirect to association page to link oauth account with existing ## Screenshots <!-- **If this issue involves the Web Interface, please include a screenshot** -->
GiteaMirror added the issue/confirmedtype/bug labels 2025-11-02 04:43:55 -06:00
Author
Owner

@stale[bot] commented on GitHub (Apr 12, 2019):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale[bot] commented on GitHub (Apr 12, 2019): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Author
Owner

@jhult commented on GitHub (May 4, 2021):

This might be related to #5005.

@jhult commented on GitHub (May 4, 2021): This might be related to #5005.
Author
Owner

@pintman commented on GitHub (Mar 28, 2023):

experienced the same issue in gitea v1.19.0 go v1.20.2

@pintman commented on GitHub (Mar 28, 2023): experienced the same issue in gitea v1.19.0 go v1.20.2
Author
Owner

@lunny commented on GitHub (Sep 29, 2024):

Can you check whether you are visiting a Gitea address that is not the one you input in the GitHub oauth2 application forms? I found that is a reason caused could not find a matching session for this request.

@lunny commented on GitHub (Sep 29, 2024): Can you check whether you are visiting a Gitea address that is not the one you input in the GitHub oauth2 application forms? I found that is a reason caused `could not find a matching session for this request`.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#2667