# Discourse GitHub Verification

**URL:** https://meta.discourse.org/t/discourse-github-verification/267030
**Category:** Plugin
**Tags:** experimental
**Created:** [June 2, 2023, 3:37pm UTC](https://meta.discourse.org/t/discourse-github-verification/267030 "2023-06-02T15:37:15Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![markvanlan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/markvanlan/32/160087_2.png) [@markvanlan](https://meta.discourse.org/u/markvanlan)
#### Post date: [June 2, 2023, 3:37pm UTC](https://meta.discourse.org/t/discourse-github-verification/267030/1 "2023-06-02T15:37:15Z")

</div>

| | | |
| --- | --- | --- |
| :discourse2: | **Summary** | Verifies that a user owns a given GitHub account |
| 🛠 | **Repository Link** | [GitHub - discourse/discourse-github-verification: Verifies that a Discourse user is the owner of a Github account · GitHub](https://github.com/discourse/discourse-github-verification) |
| 📖 | **Install Guide** | [How to install plugins in Discourse](https://meta.discourse.org/t/install-plugins-in-discourse/19157) |

### Features

This plugin allows users to verify that they own a given GitHub account. This is separate from login with GitHub. It simply displays the a link to a user’s GitHub account on their user card and profile.

A new tab (`GitHub`) is added to user preferences. There is a button to connect your account with GitHub when the user has not connected their account yet. If the user has connected their account, they will see a link to their GitHub account and a button to disconnect their GitHub account from their Discourse profile.

 ![1511f14d5db0f2c331bd201f403abbc16e71d923](https://global.discourse-cdn.com/meta/original/4X/a/2/c/a2ca9bb23d74b2411f48e15ce09edb0de729e26f.png)

 ![image](https://global.discourse-cdn.com/meta/original/4X/d/9/5/d956021a1e0ed396b33f50f0f3f238c9ba000fa9.png)

If a user has a connected GitHub account, a link will be displayed on their user card and user profile

 ![image](https://global.discourse-cdn.com/meta/original/4X/4/6/c/46c228c6a4efbaaabcaa33098f5ccfd7781dd520.png)

 ![image](https://global.discourse-cdn.com/meta/original/4X/0/e/7/0e7d2f86d16f47cab8503420d65b2d5d01a1bda9.png)

The plugin adds an admin API endpoint `/github-verification/users.json`, which returns an array of all users with a connected GitHub account. The response looks like this:

```json
[
  {
    "id": 1,
    "username": "markvanlan",
    "github_username": "markvanlan"
  }
]

```

### Configuration

#### Setup GitHub OAuth app

- Follow [GitHub’s instructions](https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/creating-an-oauth-app) on creating an OAuth app. There are two important settings to configure in the OAuth app settings

#### Configure Discourse settings

Settings can be found at `/admin/site_settings/category/all_results?filter=discourse_github_verification`

- **discourse github verification enabled** - Enables the plugin by checking in the site settings panel (`/admin/site_settings/category/all_results?filter=discourse_github_verification`).

- **discourse github verification client id** - Client ID of your GitHub OAuth app

- **discourse github verification client secret** - Client secret of your GitHub OAuth app

### Caveat

This plugin does not take into account existing login with GitHub configuration. Discourse supports this by default, but the discourse-github-verification plugin does not use a site’s existing `github client id` and `github client secret` settings. In the case these are filled in, we could probably use them instead of duplicating the settings. The plugin also does not know if a user has already logged into Discourse with Github. It would be nice to automatically detect this.

* * *

Thank you to [Sailpoint](https://www.sailpoint.com/) for sponsoring this work and making it open-source 🎉

---

<div class="post-metadata">

### Author: ![jordan-violet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jordan-violet/32/281428_2.png) [@jordan-violet](https://meta.discourse.org/u/jordan-violet)
#### Post date: [June 5, 2023, 11:30am UTC](https://meta.discourse.org/t/discourse-github-verification/267030/2 "2023-06-05T11:30:02Z")

</div>

For anyone wondering how this plugin might be useful, we had it developed to work in conjunction with the gamification plugin.

We allow our users to gain points in our contributor program by contributing to our GitHub repositories. We had this plug-in made so we could ensure that the user actually owned the GitHub account they said they did. When we have a contribution event occur in GitHub, we query our list of users with connected GitHub accounts and see if the GitHub account exists in the forum. If so, we give them the designated points.
