# Link external account

**URL:** <https://forum.gitea.com/t/link-external-account/2278>\
**Category:** General\
**Created:** [June 28, 2020, 10:49am UTC](https://forum.gitea.com/t/link-external-account/2278 "2020-06-28T10:49:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![meena](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/meena/32/4927_2.png) [@meena](https://forum.gitea.com/u/meena)\
**Post date:** [June 28, 2020, 10:49am UTC](https://forum.gitea.com/t/link-external-account/2278/1 "2020-06-28T10:49:17Z")

</div>

Hey folks,

we’ve setup a Gitea instance on [https://git.joinplu.me/](https://git.joinplu.me/) — and migrated repos, and pull requests and issues from github/Plume-org

now, i can see in my _ **Settings / Security** _ an option to _ **Manage Linked Accounts** _\*, but i don’t see anywhere a way to link an account.

Is there a way to associate `igalic (migrated from Github)` [#790 - cargo release helper - Plume - Gitea: Git with a cup of tea](https://git.joinplu.me/Plume/Plume/pulls/790) with my user (igalic) on that instance ? an account i created by registering _via_ Github!

…or, Should we have imported users as well in our migration?

---

<div class="post-metadata">

**Author:** ![tschmit](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/tschmit/32/1199_2.png) [@tschmit](https://forum.gitea.com/u/tschmit)\
**Post date:** [March 14, 2021, 3:15pm UTC](https://forum.gitea.com/t/link-external-account/2278/2 "2021-03-14T15:15:41Z")

</div>

have you found the solution ? I have the same problem.

---

<div class="post-metadata">

**Author:** ![meena](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/meena/32/4927_2.png) [@meena](https://forum.gitea.com/u/meena)\
**Post date:** [March 14, 2021, 4:01pm UTC](https://forum.gitea.com/t/link-external-account/2278/3 "2021-03-14T16:01:23Z")

</div>

no, we’ve basically given up on having a link between our historic github selves and our current selves 😒

---

<div class="post-metadata">

**Author:** ![Mai-Lapyst](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/mai-lapyst/32/5065_2.png) [@Mai-Lapyst](https://forum.gitea.com/u/Mai-Lapyst)\
**Post date:** [May 15, 2022, 11:53am UTC](https://forum.gitea.com/t/link-external-account/2278/4 "2022-05-15T11:53:50Z")

</div>

Sry for reviving this old thread, but since there is next to no documentation on this, and google brought me to this thread, I think I should share my knowledge so others who have the same problem don’t need to spend hours reading sourcecode to figure this out.

Basically you need to create an authentication source in the administration. Pick OAuth2 as type and name it `gitlab` (this is very important!); pick as provider also “GitLab”. Fill in clientID and secret of your Oauth application you created in gitlab (see below) and also check “Use Custom URLs”.  
Fill in these:

- Authorize URL: `https://<your gitlab domain>/oauth/authorize`
- Token URL: `https://<your gitlab domain>/oauth/token`
- Profile URL: `https://<your gitlab domain>/api/v3/user`

Now to the gitlab side: Go into user\>Apllications (or inside the Admin panel\>Applications) and create an new OAuth application. Name it like you want; As redirection url you put `https://<your gitea domain>/user/oauth2/gitlab/callback`.  
No clue what exact scopes it really needs but it definitivly works with these settings:

- Trusted: Yes
- Confidential: Yes
- Scopes:
  - read\_api
  - read\_user
  - profile
  - email  
Save it and copy the clientID and secret over to gitea as mentioned above.

Now the part I’ve (and most others I belive) got really stuck: you need to logout. When going to the login site, you now have an gitlab icon. Click it, you well get redirected to your gitlab account (if not set to trusted, you might need to approve the application or input 2FA or similar thinks), after that you get redirected back to gitea to be greetet by another dialog: you now kan choose if you want to create an account or login to an existing account. If you login using your account it will link your gitlab to your gitea. It also _should_ run an task in the background to update all old references to your gitlab account with your gitea user. If not: go into the administraion setting, Monitoring and execute the cron task “Update migration poster IDs”. This will also trigger the code to update the old id’s.

Note: 1.16.7 has seemingly a bug where oauth currently dosnt work as intended (500 after beeing redirected back to gitea from gitlab), but in the master branch it works definitvely.

Hope I could help somebody 🙂

---

<div class="post-metadata">

**Author:** ![dachary](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/dachary/32/4990_2.png) [@dachary](https://forum.gitea.com/u/dachary)\
**Post date:** [May 15, 2022, 3:38pm UTC](https://forum.gitea.com/t/link-external-account/2278/6 "2022-05-15T15:38:09Z")

</div>

> [@Mai-Lapyst](#):
>
> 1.16.7 has seemingly a bug where oauth currently dosnt work as intended (500 after beeing redirected back to gitea from gitlab), but in the master branch it works definitvely.

It is worth a bug report with detailed instructions to repeat it.

---

<div class="post-metadata">

**Author:** ![lunny](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/lunny/32/4701_2.png) [@lunny](https://forum.gitea.com/u/lunny)\
**Post date:** [May 15, 2022, 4:49pm UTC](https://forum.gitea.com/t/link-external-account/2278/7 "2022-05-15T16:49:49Z")

</div>

You should add an OAuth2 Github auth source first, then you should find the button or login with Github will let you binding.
