Skip to content

New-GitHubAppInstallationAccessToken

SYNOPSIS

Create an installation access token for an app

SYNTAX

New-GitHubAppInstallationAccessToken [-InstallationID] <Int32> [-ProgressAction <ActionPreference>]
 [<CommonParameters>]

DESCRIPTION

Creates an installation access token that enables a GitHub App to make authenticated API requests for the app's installation on an organization or individual account. Installation tokens expire one hour from the time you create them. Using an expired token produces a status code of 401 - Unauthorized, and requires creating a new installation token. By default the installation token has access to all repositories that the installation can access.

Optionally, you can use the repositories or repository_ids body parameters to specify individual repositories that the installation access token can access. If you don't use repositories or repository_ids to grant access to specific repositories, the installation access token will have access to all repositories that the installation was granted access to. The installation access token cannot be granted access to repositories that the installation was not granted access to. Up to 500 repositories can be listed in this manner.

Optionally, use the permissions body parameter to specify the permissions that the installation access token should have. If permissions is not specified, the installation access token will have all of the permissions that were granted to the app. The installation access token cannot be granted permissions that the app was not granted.

When using the repository or permission parameters to reduce the access of the token, the complexity of the token is increased due to both the number of permissions in the request and the number of repositories the token will have access to. If the complexity is too large, the token will fail to be issued. If this occurs, the error message will indicate the maximum number of repositories that should be requested. For the average application requesting 8 permissions, this limit is around 5000 repositories. With fewer permissions requested, more repositories are supported.

You must use a JWT to access this endpoint.

EXAMPLES

EXAMPLE 1

New-GitHubAppInstallationAccessToken -InstallationID 12345678

Creates an installation access token for the installation with the ID 12345678.

EXAMPLE 2

Connect-GitHub -ClientID $ClientID -PrivateKey $PrivateKey -Verbose
Get-GitHubAppInstallation | New-GitHubAppInstallationAccessToken

Gets the GitHub App installations and creates an installation access token for each installation.

PARAMETERS

-InstallationID

The unique identifier of the installation. Example: '12345678'

Type: Int32
Parameter Sets: (All)
Aliases: ID

Required: True
Position: 1
Default value: 0
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False

-ProgressAction

{{ Fill ProgressAction Description }}

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

NOTES

Create an installation access token for an app