# Setting user authentication source and sign-in name through CLI

**URL:** <https://forum.gitea.com/t/setting-user-authentication-source-and-sign-in-name-through-cli/3019>\
**Category:** Install/Maintain/Configure\
**Created:** [March 3, 2021, 9:49pm UTC](https://forum.gitea.com/t/setting-user-authentication-source-and-sign-in-name-through-cli/3019 "2021-03-03T21:49:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![netcicd](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/netcicd/32/2760_2.png) [@netcicd](https://forum.gitea.com/u/netcicd)\
**Post date:** [March 3, 2021, 9:49pm UTC](https://forum.gitea.com/t/setting-user-authentication-source-and-sign-in-name-through-cli/3019/1 "2021-03-03T21:49:49Z")

</div>

I have configured Keycloak as OpenID provider in Gitea. Logging in with users defined in Keycloak requires identical users to be defined locally in Gitea, though I understand that better integration comes with the resolution of issues 7633 and 5123.

In the mean time: is there any possibility to configure the user with the correct authentication source and sign-in name through the CLI when creating the user? I do not see the options in the [Usage: Command Line - Docs](https://docs.gitea.io/en-us/command-line/#admin) list op options…

---

<div class="post-metadata">

**Author:** ![techknowlogick](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/techknowlogick/32/4706_2.png) [@techknowlogick](https://forum.gitea.com/u/techknowlogick)\
**Post date:** [March 5, 2021, 3:31am UTC](https://forum.gitea.com/t/setting-user-authentication-source-and-sign-in-name-through-cli/3019/2 "2021-03-05T03:31:22Z")

</div>

You can do it via CLI, look for `add-oauth` admin subcommand on the page you linked (note: the page you linked is for 1.14-dev, and may be slightly different for most recent stable version of 1.13.3, please refer to CLI help text using `-h` when running gitea via command line)

---

<div class="post-metadata">

**Author:** ![netcicd](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/netcicd/32/2760_2.png) [@netcicd](https://forum.gitea.com/u/netcicd)\
**Post date:** [March 5, 2021, 8:15am UTC](https://forum.gitea.com/t/setting-user-authentication-source-and-sign-in-name-through-cli/3019/3 "2021-03-05T08:15:09Z")

</div>

Thx for the reply.  
I did that for defining the Keycloak authentication source globally and that works perfectly fine.

However, if you go to site administration-\>user accounts, the users remain linked to “local”. I have to manually set them to Keycloak for it to work properly in Firefox. In Google Chrome it works somehow.

And I was wondering how I can set that user config to the keycloak authentication source and adding the associated username. I cannot seem to do this using the command you proposed…

---

<div class="post-metadata">

**Author:** ![kimbj95](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/kimbj95/32/2718_2.png) [@kimbj95](https://forum.gitea.com/u/kimbj95)\
**Post date:** [June 22, 2022, 11:19pm UTC](https://forum.gitea.com/t/setting-user-authentication-source-and-sign-in-name-through-cli/3019/4 "2022-06-22T23:19:00Z")

</div>

Hi @netcicd, did you find a work around for this issue? I’m having the same problem, and looking for CLI or API for this.

---

<div class="post-metadata">

**Author:** ![netcicd](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/netcicd/32/2760_2.png) [@netcicd](https://forum.gitea.com/u/netcicd)\
**Post date:** [June 23, 2022, 2:15pm UTC](https://forum.gitea.com/t/setting-user-authentication-source-and-sign-in-name-through-cli/3019/5 "2022-06-23T14:15:43Z")

</div>

Nope, not yet. So far, only the admin can be done through OpenID, users I am still waiting for.
