# OpenID authentication with prefilled username for new accounts?

**URL:** <https://forum.gitea.com/t/openid-authentication-with-prefilled-username-for-new-accounts/7489>\
**Category:** Install/Maintain/Configure\
**Created:** [June 28, 2023, 6:36am UTC](https://forum.gitea.com/t/openid-authentication-with-prefilled-username-for-new-accounts/7489 "2023-06-28T06:36:32Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![OCram85](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/ocram85/32/4947_2.png) [@OCram85](https://forum.gitea.com/u/OCram85)\
**Post date:** [June 28, 2023, 6:36am UTC](https://forum.gitea.com/t/openid-authentication-with-prefilled-username-for-new-accounts/7489/1 "2023-06-28T06:36:32Z")

</div>

Hey folks,  
just set up another gitea instance with authelia as OpenID provided.

Is there any way to use and force the OpenID provided username (preferred\_username openid field from claim) for new accounts?

* * *

#### 📎 Used Resources

- OpenID scope definitions: [OpenID Connect 1.0 | Integration | Authelia](https://www.authelia.com/integration/openid-connect/introduction/#profile)
- Authelia Integration for Gitea: [https://www.authelia.com/integration/openid-connect/clients/gitea/](https://www.authelia.com/integration/openid-connect/gitea/)

---

<div class="post-metadata">

**Author:** ![jake](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@jake](https://forum.gitea.com/u/jake)\
**Post date:** [June 28, 2023, 5:46pm UTC](https://forum.gitea.com/t/openid-authentication-with-prefilled-username-for-new-accounts/7489/2 "2023-06-28T17:46:40Z")

</div>

See [this comment](https://github.com/go-gitea/gitea/issues/16674#issuecomment-1503878857) on GitHub:

> I realize this is pretty old, but have you tried the `ENABLE_AUTO_REGISTRATION = true` [flag](https://docs.gitea.io/en-us/config-cheat-sheet/#oauth2-client-oauth2_client) combined with the `ACCOUNT_LINKING = auto` flag? I think that might give you your desired behavior. It will skip the screen that allows users to set their username/email when logging in for the first time via OIDC. If no user with the IdP-provided email exists, it will create a new user, whereas if a user with the IdP-provided email already exists, it will link that login to the existing user. Users won’t have a chance to set those parameters.

---

<div class="post-metadata">

**Author:** ![OCram85](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/ocram85/32/4947_2.png) [@OCram85](https://forum.gitea.com/u/OCram85)\
**Post date:** [June 29, 2023, 10:07am UTC](https://forum.gitea.com/t/openid-authentication-with-prefilled-username-for-new-accounts/7489/3 "2023-06-29T10:07:39Z")

</div>

Thanks for the advice. It helped somehow but ended in a internal server error 500 in gitea.

It seems like Gitea can’t resolve the openid/ oauth2 attributes from authelia.  
So I tried to set the config keys OPENID\_CONNECT\_SCOPES, and USERNAME but can’t find the correct values therefore.

## ✅ Solved it with these settings:

```auto
- GITEA __openid__ ENABLE_OPENID_SIGNIN=true
- GITEA __openid__ ENABLE_OPENID_SIGNUP=true
- GITEA __oauth2_client__ ENABLE_AUTO_REGISTRATION=true
- GITEA __oauth2_client__ ACCOUNT_LINKING=auto
- GITEA __oauth2_client__ USERNAME=nickname
- GITEA __oauth2_client__ OPENID_CONNECT_SCOPES=openid profile email

```

---

<div class="post-metadata">

**Author:** ![hmoffatt](https://avatars.discourse-cdn.com/v4/letter/h/c57346/32.png) [@hmoffatt](https://forum.gitea.com/u/hmoffatt)\
**Post date:** [January 29, 2024, 4:42am UTC](https://forum.gitea.com/t/openid-authentication-with-prefilled-username-for-new-accounts/7489/4 "2024-01-29T04:42:48Z")

</div>

> [@OCram85](#):
>
> ```auto
> - GITEA __openid__ ENABLE_OPENID_SIGNIN=true
> - GITEA __openid__ ENABLE_OPENID_SIGNUP=true
> 
> ```

Doesn’t this refer to OpenID rather than OpenID **Connect**? I’ve set both to false but I’m still able to login via OpenID Connect.

---

<div class="post-metadata">

**Author:** ![Madhusudan-Samantray](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/madhusudan-samantray/32/6640_2.png) [@Madhusudan-Samantray](https://forum.gitea.com/u/Madhusudan-Samantray)\
**Post date:** [January 28, 2025, 6:01am UTC](https://forum.gitea.com/t/openid-authentication-with-prefilled-username-for-new-accounts/7489/5 "2025-01-28T06:01:19Z")

</div>

How can i setup openid server with gitea . Do we have a setup guide. I want to setup my cf UAA as openid server

---

<div class="post-metadata">

**Author:** ![hmoffatt](https://avatars.discourse-cdn.com/v4/letter/h/c57346/32.png) [@hmoffatt](https://forum.gitea.com/u/hmoffatt)\
**Post date:** [January 29, 2025, 11:52pm UTC](https://forum.gitea.com/t/openid-authentication-with-prefilled-username-for-new-accounts/7489/6 "2025-01-29T23:52:25Z")

</div>

Settings are in site administration \> Identity & Access \> Authentication Sources.

Further tweaks are in the config file: [Configuration Cheat Sheet | Gitea Documentation](https://docs.gitea.com/administration/config-cheat-sheet#openid-openid)

---

<div class="post-metadata">

**Author:** ![Madhusudan-Samantray](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/madhusudan-samantray/32/6640_2.png) [@Madhusudan-Samantray](https://forum.gitea.com/u/Madhusudan-Samantray)\
**Post date:** [January 30, 2025, 6:43am UTC](https://forum.gitea.com/t/openid-authentication-with-prefilled-username-for-new-accounts/7489/7 "2025-01-30T06:43:20Z")

</div>

![image](https://us1.discourse-cdn.com/flex020/uploads/gitea/original/2X/f/f3203e9b355b3ec0283b0fcc34cd381f84e3c2a6.png)

I am getting this error ,

---

<div class="post-metadata">

**Author:** ![Madhusudan-Samantray](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/madhusudan-samantray/32/6640_2.png) [@Madhusudan-Samantray](https://forum.gitea.com/u/Madhusudan-Samantray)\
**Post date:** [January 30, 2025, 6:46am UTC](https://forum.gitea.com/t/openid-authentication-with-prefilled-username-for-new-accounts/7489/8 "2025-01-30T06:46:21Z")

</div>

![image (1)](https://us1.discourse-cdn.com/flex020/uploads/gitea/original/2X/f/f14b497bbe6725fa7ae3e05c3ebeb3529290e0fe.png)

Here is my configuration . Am i missing something .

---

<div class="post-metadata">

**Author:** ![hmoffatt](https://avatars.discourse-cdn.com/v4/letter/h/c57346/32.png) [@hmoffatt](https://forum.gitea.com/u/hmoffatt)\
**Post date:** [February 6, 2025, 12:39am UTC](https://forum.gitea.com/t/openid-authentication-with-prefilled-username-for-new-accounts/7489/9 "2025-02-06T00:39:38Z")

</div>

It looks like the configuration it is getting from the [logon.ds.ge.com](http://logon.ds.ge.com) site may be wrong.
