This directory contains helper scripts to generate installation access tokens for the GitHub App.
A bash script that uses OpenSSL and curl to generate tokens.
Requirements:
bashopensslcurl
Usage:
./generate-app-token.sh <app_id> <installation_id> <private_key_path>Example:
./generate-app-token.sh 123456 789012 ./github-app-key.pemA Python script that uses PyJWT and requests libraries to generate tokens.
Requirements:
- Python 3.6+
PyJWTlibrarycryptographylibraryrequestslibrary
Installation:
pip install PyJWT cryptography requestsUsage:
python generate-app-token.py <app_id> <installation_id> <private_key_path>Example:
python generate-app-token.py 123456 789012 ./github-app-key.pemTo use these scripts, you need three pieces of information from the GitHub App:
- App ID: Found in your GitHub App settings under "About"
- Installation ID:
- Go to your GitHub App settings
- Click on "Install App" in the sidebar
- Click on the installation (repository)
- The installation ID is in the URL:
https://github.com/settings/installations/[INSTALLATION_ID]
- Private Key: Generated and downloaded from your GitHub App settings
- Validity: Installation access tokens are valid for 1 hour
- Permissions: Tokens inherit the permissions configured in your GitHub App
- Scope: Tokens are scoped to the repositories where the app is installed
Once generated, you can use the token for:
# Clone
git clone https://x-access-token:TOKEN@github.com/ZHosein/vio-on-arm.git
# Add remote
git remote add origin https://x-access-token:TOKEN@github.com/ZHosein/vio-on-arm.git# Login
echo TOKEN | docker login ghcr.io -u x-access-token --password-stdin
# Pull image
docker pull ghcr.io/zhosein/vio-on-arm:latest# Set for current session
export GITHUB_TOKEN=TOKEN
# Use with git
git clone https://x-access-token:$GITHUB_TOKEN@github.com/ZHosein/vio-on-arm.gitMake sure the scripts are executable:
chmod +x generate-app-token.sh
chmod +x generate-app-token.pyInstall the required Python packages:
pip install PyJWT cryptography requests- Verify your App ID is correct
- Verify your Installation ID is correct
- Ensure your private key file is valid and readable
- Check that your GitHub App has the necessary permissions
- Never commit private keys to version control
- Keep your private keys secure
- Rotate keys periodically
- Use different apps/tokens for different environments
- Tokens expire after 1 hour - regenerate as needed