> ## Documentation Index
> Fetch the complete documentation index at: https://docs.refold.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Setup

> Connect to your GitHub app for OAuth.

To setup your GitHub app in Refold for OAuth, you will need the following credentials from your [GitHub Developer account](https://github.com/settings/developers):

* Client ID
* Client Secret
* Scopes

### Pre-requisites

1. GitHub Developer account. You can create one [here](https://github.com/signup).

<Info>If you haven't already created an app in GitHub, you'd need to create one.</Info>

### Creating an app in GitHub

To create a GitHub app and acquire the above mentioned credentials, please follow the steps mentioned below:

1. Log in to your [GitHub Developer account](https://github.com/settings/developers).
2. Click on the `Profile` icon in the top right, select `Settings` > Select `Developer Settings` > Choose `OAuth Apps` in the left menu.

<img height="200" src="https://mintlify.s3.us-west-1.amazonaws.com/cobalt-55/images/Github/github_navigation.png" alt="Navigation for App setup" />

3. Go to your [`Apps catalog`](https://app.gocobalt.io/apps) in **Refold** > Search for `Github` > `Settings` > `Use your credentials` > `Callback Url` > Copy it.
4. Click on `New OAuth App` button in the right.
5. Enter the App Name for your application, provide a homepage URL, paste the Callback URL under `Authorization callback URL` and click on `Register application`.

<img height="200" src="https://mintcdn.com/cobalt-55/h1VL7v_8HaANGLZ5/images/Github/github_config.png?fit=max&auto=format&n=h1VL7v_8HaANGLZ5&q=85&s=0ceefa05744c35af705a532005751087" alt="Setting up GitHub Developer app" data-path="images/Github/github_config.png" />

6. Navigate to `General` in the left menu and copy the **Client ID**. Click on `Generate a new client secret` and copy the **Client Secret**.

<img height="200" src="https://mintcdn.com/cobalt-55/h1VL7v_8HaANGLZ5/images/Github/github_credentials.png?fit=max&auto=format&n=h1VL7v_8HaANGLZ5&q=85&s=5b887a39a41cbfe022cc6f3b64111ad7" alt="Getting Credentials" data-path="images/Github/github_credentials.png" />

#### Configuring credentials in Refold

App settings page lets you configure the authentication settings for an `OAuth2` based application. For your customers to provide you authorization to access their data,
they would first need to install your application. This page lets you set up your application credentials.

<img height="200" src="https://mintcdn.com/cobalt-55/h1VL7v_8HaANGLZ5/images/Github/github_cobalt.png?fit=max&auto=format&n=h1VL7v_8HaANGLZ5&q=85&s=f25de2e3ae7d586e2aaad0819341fa01" alt="Setting up application client credentials" data-path="images/Github/github_cobalt.png" />

Provide the acquired Client ID and Client Secret under Settings of the app and save it.

#### Configuring Scopes

Refold lets you configure what permissions to ask from your users while they install your application. The scopes can be added or removed from the App settings page, under `Permissions & Scopes`
section.

For some applications Refold sets **mandatory scopes** which cannot be removed. Additional scopes can be selected from the drop down. Refold also has the provision to add any
custom scopes supported by the respective platform.

<img height="200" src="https://mintcdn.com/cobalt-55/h1VL7v_8HaANGLZ5/images/Github/github_scopes.png?fit=max&auto=format&n=h1VL7v_8HaANGLZ5&q=85&s=99132d3b46d3e6a0f4a7673a74d3931e" alt="OAuth Scopes" data-path="images/Github/github_scopes.png" />

Once the scopes has been added to the application in Refold, the app will now request for access of the mentioned scopes.

<Warning>
  If you are facing scopes missing or invalid scope error. Make sure you are not passing any custom scope not supported by the platform.
</Warning>

#### Actions and triggers

Once the above setup is completed, you can create orchestrations of your use-cases using GitHub actions and triggers. Following are the set of GitHub actions and triggers
supported by Refold.

<Tabs>
  <Tab title="Actions">
    <AccordionGroup>
      <Accordion title="Issue">
        1. **Create Issue** - Create an issue in GitHub.
        2. **Update Issue** - Update an issue in GitHub.
        3. **Lock Issue** - Lock an issue in GitHub.
        4. **Unlock Issue** - Unlock an issue in GitHub.
      </Accordion>

      <Accordion title="User">
        5. **List Events for User** - List events for a user in GitHub.
        6. **Get Authenticated User** - Get the authenticated user in GitHub.
      </Accordion>

      <Accordion title="Others">
        7. **HTTP Request** - Make HTTP API calls to any GitHub documented REST APIs.
        8. **List Organization Members** - List organization members in GitHub.
        9. **Billing for an Organization** - Get the billing for an organization in GitHub.
        10. **Weekly Commit Activity** - Get the weekly commit activity in GitHub.
      </Accordion>
    </AccordionGroup>
  </Tab>

  <Tab title="Triggers">
    There are no triggers in this application.
  </Tab>
</Tabs>
