Skip to main content

Utility script to produce a github app access token.

Project description

GitHub App Access Token Fetcher

Utility to get access tokens for a GitHub App.

Prerequisites

  • The GitHub App must be created and installed.
  • A private key must be generated (from the GitHub App settings UI) and its content should be written as binary data to an AWS Secretsmanager secret.

To set up the private key, do something like this (assuming the secret is created already):

import boto3
secret_arn = "arn:aws:secretsmanager:us-east-1:1234:secret:my-secret-name"
pem_file = "/path/to/private_key.pem"
client = boto3.client('secretsmanager', region_name=secret_arn.split(':')[3])
with open(pem_file, 'rb') as f:
    client.put_secret_value(SecretId=secret_arn, SecretBinary=f.read())

Install

pip install github-app-access-token-fetcher

Usage

get-github-app-token --help

usage: get-github-app-token [-h] --app-id APP_ID --private-key-secret-arn PRIVATE_KEY_SECRET_ARN

Get a GitHub App token

optional arguments:
  -h, --help            show this help message and exit
  --app-id APP_ID       GitHub App ID
  --private-key-secret-arn PRIVATE_KEY_SECRET_ARN
                        ARN of the secret containing the GitHub App private key

Example:

export AWS_PROFILE=...  # Something with access to the private key secret.
get-github-app-token \
    --app-id 1234 \
    --private-key-secret-arn arn:aws:secretsmanager:us-west-1:4321:secret:abc-1234

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

github-app-access-token-fetcher-1.0.1.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file github-app-access-token-fetcher-1.0.1.tar.gz.

File metadata

File hashes

Hashes for github-app-access-token-fetcher-1.0.1.tar.gz
Algorithm Hash digest
SHA256 cd00d670e858b9526703827af338d0ec5766c1e7069a6b23f46a7bba56d4bbea
MD5 9a4909218fbcb587a7b1a53c547de8ff
BLAKE2b-256 4e4ff76e1db367984ca9f6aaeb6f588dc225479171673966b56d598999948e26

See more details on using hashes here.

File details

Details for the file github_app_access_token_fetcher-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for github_app_access_token_fetcher-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7281e91b2c3b350e846a9257bc6b0f7afa13ae5a55fd7d1bf57c8c4ec1fc523c
MD5 2f606679b05bc8dd3e4b828a3c0c3aaa
BLAKE2b-256 00bfc2635ab5300f5df18d84740895b90c7633ef98479e0af5408dbdc338b6e6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page