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

# GitHub dynamic secrets

> Learn how to dynamically generate GitHub App tokens.

The Infisical GitHub dynamic secret allows you to generate short-lived tokens for a GitHub App on demand based on service account permissions.

## Setup GitHub App

**1. Create an application on GitHub**

Navigate to [GitHub App settings](https://github.com/settings/apps) and select **New GitHub App**.

![integrations github app create](https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/integrations/github/app/self-hosted-github-app-create.png)

Give the application a name and a homepage URL. These values do not need to be anything specific.

Disable webhook by unchecking the Active checkbox.

![integrations github app webhook](https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/integrations/github/app/self-hosted-github-app-webhook.png)

Configure the app's permissions to grant the necessary access for the dynamic secret's short-lived tokens based on your use case.

Create the GitHub Application.

![integrations github app create confirm](https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/integrations/github/app/self-hosted-github-app-create-confirm.png)

> [!NOTE]
>
> If you have a GitHub organization, you can create an application under it
> in your organization Settings > Developer settings > GitHub Apps > New GitHub App.

**2. Save app credentials**

Copy the **App ID** and generate a new **Private Key** for your GitHub Application.

![integrations github app create private key](https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/integrations/github/app/self-hosted-github-app-private-key.png)

Save these for later steps.

**3. Install app**

Install your application to whichever repositories and organizations that you want the dynamic secret to access.

![Install App](https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/github/install-app.png)

![Install App](https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/github/install-app-modal.png)

Once you've installed the app, **copy the installation ID** from the URL and save it for later steps.

![Install App](https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/github/installation.png)

## Set up dynamic secrets with GitHub

**1. Open Secret Overview Dashboard**

Open the Secret Overview dashboard and select the environment in which you would like to add a dynamic secret.

**2. Click on the 'Add Dynamic Secret' button**

![Add Dynamic Secret Button](https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/add-dynamic-secret-button.png)

**3. Select 'GitHub'**

![Dynamic Secret Modal](https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/github/modal.png)

**4. Provide the inputs for dynamic secret parameters**

**Secret Name** `string` *required*

Name by which you want the secret to be referenced

**App ID** `string` *required*

The ID of the app created in earlier steps.

**App Private Key PEM** `string` *required*

The Private Key of the app created in earlier steps.

**Installation ID** `string` *required*

The ID of the installation from earlier steps.

**5. Click `Submit`**

After submitting the form, you'll see a dynamic secret created in the dashboard.

**6. Generate dynamic secrets**

Once you've successfully configured the dynamic secret, you're ready to generate on-demand credentials.
To do this, simply select the 'Generate' button which appears when hovering over the dynamic secret item.
Alternatively, you can initiate the creation of a new lease by selecting 'New Lease' from the dynamic secret lease list section.

![Dynamic Secret](https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-generate.png)

![Dynamic Secret](https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-lease-empty.png)

When generating these secrets, the TTL will be fixed to 1 hour.

![Provision Lease](https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/provision-lease.png)

Once you click the `Submit` button, a new secret lease will be generated and the credentials from it will be shown to you.

![Dynamic Secret Lease](https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/github/lease.png)

## Audit or revoke leases

Once you have created one or more leases, you'll be able to access them by selecting the respective dynamic secret item on the dashboard.

This will allow you to see the expiration time of the lease or delete a lease before its set time to live.

![Lease Data](https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/lease-data.png)

> [!WARNING]
>
> GitHub App tokens can't be revoked. As such, revoking a token on Infisical doesn't invalidate the GitHub token; it remains active until it expires.

## Renew leases

> [!NOTE]
>
> GitHub App tokens can't be renewed because they're fixed to a lifetime of 1 hour.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.