# GitHub

### GitHub as OAuth Identity Provider

To use GitHub as Auth Provider, you must setup a so-called "OAuth App". You can do so in your Github Profile > Settings <https://github.com/settings/developers>

<figure><img src="https://1375341043-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fzo5R6EJIlCfRyDLbDnBv%2Fuploads%2Fgit-blob-2bd518818df5221dd725ddd602cf17911bd4474c%2FGithub%20OAuth%20Apps.png?alt=media" alt=""><figcaption></figcaption></figure>

On GitHub the creation of an OAuth Client Registration is comparatively simple.

<figure><img src="https://1375341043-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fzo5R6EJIlCfRyDLbDnBv%2Fuploads%2Fgit-blob-771dc92d9a3c989a94f90ba7fea630327e7ec6d5%2FGithub%20Client%20OAuth%20Settings.png?alt=media" alt=""><figcaption><p>GitHub Client Registration Settings</p></figcaption></figure>

After configuring the Callback URLs, you can "Generate a new client secret".

{% hint style="warning" %}
Make sure you copy the client secret directly, as it is displayed only once. Later you cannot copy it again.
{% endhint %}

Now you go back to OpenFlower Settings > Auth Providers and click "Add OAuth Provider" and select GitHub from the list of Auth Providers.

<figure><img src="https://1375341043-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fzo5R6EJIlCfRyDLbDnBv%2Fuploads%2Fgit-blob-db59be8fd6bed0d1dad248f1dd96dbc6f172cee1%2FOAuth%20Add%20Provider.png?alt=media" alt=""><figcaption></figcaption></figure>

You can copy and paste now the Client ID and Client Secret from the GitHub Client App Registration.

<figure><img src="https://1375341043-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fzo5R6EJIlCfRyDLbDnBv%2Fuploads%2Fgit-blob-2034f31a7e8663fbea8f3d823796e3228b5703df%2FGitHub%20setup%20Auth%20Client.png?alt=media" alt=""><figcaption></figcaption></figure>

Thats it! Now you can invite new Users to OpenFlower. They can choose GitHub to Sign Up (register) or Sign in / log in.

<figure><img src="https://1375341043-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fzo5R6EJIlCfRyDLbDnBv%2Fuploads%2Fgit-blob-6e11680fa1b589813621859c2e178a5dd541bd45%2FOAuth%20Register%20with%20Invite%20Link%20(1).png?alt=media" alt=""><figcaption></figcaption></figure>

When users chose to Sign in or Sign up with GitHub, they will get redirected to the GitHub Login page of the registered Client App

<figure><img src="https://1375341043-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fzo5R6EJIlCfRyDLbDnBv%2Fuploads%2Fgit-blob-4bf5cea4d6cee9f656b9440ed51cad5965cdc319%2FGithub%20OAuth%20Login.png?alt=media" alt=""><figcaption></figcaption></figure>

Here they have to Authorize your registered Client App to act and impersonate your users.

<figure><img src="https://1375341043-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fzo5R6EJIlCfRyDLbDnBv%2Fuploads%2Fgit-blob-0ff4e0481b806e0294aa59dabc32191e2960c861%2FGithub%20OAuth%20Authorize.png?alt=media" alt=""><figcaption></figcaption></figure>
