GitHub Session Manager

Issue a GitHub App installation access token and optionally rewire workflows to a fresh githubApi credential.

Overview

The GitHub Session Manager node issues a GitHub App installation access token and optionally rewires workflows to use a fresh GitHub API credential. It is useful for automating token management for GitHub App integrations within n8n workflows, ensuring tokens are up-to-date and workflows are seamlessly updated to use new credentials. For example, it can be used to generate access tokens for GitHub API requests and automatically rotate credentials across workflows to maintain security and functionality.

Use Case Examples

  1. Generating a fresh GitHub App installation token to authenticate subsequent HTTP Request nodes.
  2. Automatically rotating GitHub API credentials and updating workflows to use the new token without manual intervention.

Properties

Name Meaning
decorateHeader If true, adds Authorization and Accept headers with the GitHub token into item.json.headers for chaining into an HTTP Request node.
doRewire If true, creates a new GitHub API credential with the fresh token and rewires workflows from the selected GitHub API credential to the new one.
targetGithubCredentialId The existing GitHub API credential ID to rewire workflows from. Required if doRewire is enabled.
newCredentialName Name for the new GitHub API credential that holds the fresh token. Used when doRewire is enabled.
permissions Optionally restrict permissions of the issued installation token by specifying resource and access level (read or write).
repositories Comma-separated list of repositories to limit the token to, if the installation is repository-scoped.

Output

JSON

  • githubToken - The issued GitHub App installation access token.
  • githubTokenExpiresAt - Expiration timestamp of the issued token.
  • headers
    • Authorization - Authorization header with the Bearer token, added if decorateHeader is true.
    • Accept - Accept header set to 'application/vnd.github+json', added if decorateHeader is true.
  • rewire
    • fromCredentialId - ID of the old GitHub API credential being replaced (present if doRewire is enabled).
    • toCredentialId - ID of the new GitHub API credential created with the fresh token (present if doRewire is enabled).
    • workflowsUpdated - Number of workflows updated to use the new credential (present if doRewire is enabled).

Dependencies

  • GitHub App JWT credential
  • n8n API credential (optional, required if doRewire is enabled)
  • GitHub API credential

Troubleshooting

  • Ensure the GitHub App JWT credential is correctly configured with valid appId, installationId, and privateKey.
  • If 'Rotate by rewire' is enabled, an n8n API credential with a valid API key/token must be provided.
  • The 'Target GitHub Credential' must be selected when rewiring is enabled.
  • Common errors include missing credentials or API keys, which prevent token issuance or workflow rewiring.
  • Check that repository names in the 'Repositories' field are correctly formatted as 'owner/repo' and separated by commas.

Links

Discussion