Support arbitrary oauth2 username and email sources #11174

Open
opened 2025-11-02 09:29:45 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @devon-mar on GitHub (Jul 6, 2023).

Feature Description

Currently the username source for new oauth2 accounts is limited to userid, nickname and email as per the config cheat sheet. I would like to use any field in goth.User.RawData for the Gitea user's email and/or username.

I would like to:

  • Change the oauth2_client.USERNAME setting to take any value. If the value is not one of the current 3 options, use the value to get the username in RawData.
  • Add a oauth2_client.EMAIL setting with default value email that will be used to configure the email source. If the value is email, use goth.User.Email. Otherwise, use the value to get the email from RawData.

I can make a PR if accepted.

Screenshots

No response

Originally created by @devon-mar on GitHub (Jul 6, 2023). ### Feature Description Currently the username source for new oauth2 accounts is limited to `userid`, `nickname` and `email` as per the [config cheat sheet](https://docs.gitea.com/next/administration/config-cheat-sheet). I would like to use any field in `goth.User.RawData` for the Gitea user's email and/or username. I would like to: - Change the `oauth2_client.USERNAME` setting to take any value. If the value is not one of the current 3 options, use the value to get the username in `RawData`. - Add a `oauth2_client.EMAIL` setting with default value `email` that will be used to configure the email source. If the value is `email`, use `goth.User.Email`. Otherwise, use the value to get the email from `RawData`. I can make a PR if accepted. ### Screenshots _No response_
GiteaMirror added the type/proposal label 2025-11-02 09:29:45 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#11174