Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update generating-a-json-web-token-jwt-for-a-github-app.md #36105

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

frjtrifork
Copy link

Why: Python JWT example script throws an error without cryptography module

In a fresh python installation the python script for getting a JWT needs both the 'PyJWT' and the 'cryptography' pip packages installed.

Can be verified using a fresh docker python:3-alpine image:

docker run -v $(pwd):/app -w /app python:3-alpine \
  sh -c 'pip install PyJWT; python githubJwt.py ghapp.private-key.pem CLIENT_ID'

The command above will throw an error:
NotImplementedError: Algorithm 'RS256' could not be found. Do you have cryptography installed?

If you add the cryptography package to pip install, it works:

docker run -v $(pwd):/app -w /app python:3-alpine \
  sh -c 'pip install PyJWT cryptography; python githubJwt.py ghapp.private-key.pem CLIENT_ID'

Closes: #36104

What's being changed (if available, include any code snippets, screenshots, or gifs):

The pip install note above the Python example script is being updated to include both the 'PyJWT' and the 'cryptography' packages.

Check off the following:

  • A subject matter expert (SME) has reviewed the technical accuracy of the content in this PR. In most cases, the author can be the SME. Open source contributions may require an SME review from GitHub staff.
  • The changes in this PR meet the docs fundamentals that are required for all content.
  • All CI checks are passing and the changes look good in the preview environment.

In a fresh python installation the script needs both the PyJWT and the cryptography pip packages.

Can be verified using a fresh docker python:3-alpine image:

docker run -v $(pwd):/app -w /app python:3-alpine sh -c 'pip install PyJWT cryptography; python githubJwt.py some-github-app.2025-01-30.private-key.pem THE_GITHUB_APP_CLIENT_ID'

Without pip install cryptography the command above will throw an error:
NotImplementedError: Algorithm 'RS256' could not be found. Do you have cryptography installed?

After `pip install PyJWT cryptography` it works
Copy link

welcome bot commented Jan 30, 2025

Thanks for opening this pull request! A GitHub docs team member should be by to give feedback soon. In the meantime, please check out the contributing guidelines.

Copy link
Contributor

github-actions bot commented Jan 30, 2025

👓 Previews for changed content

This comment is 🤖 automatically generated and will be overwritten every time changes are committed to this branch.

The table contains an overview of files in the content directory that have been changed in this pull request. It's provided to make it easy to review your changes on the review server. Please note that changes to the data directory will not show up in this table.


Content directory changes

You may find it useful to copy this table into the pull request summary. There you can edit it to share links to important articles or changes and to give a high-level overview of how the changes in your pull request support the overall goals of the pull request.

Source Preview Production What Changed
apps/creating-github-apps/authenticating-with-a-github-app/generating-a-json-web-token-jwt-for-a-github-app.md fpt
ghec
ghes@ 3.15 3.14 3.13 3.12 3.11 3.10
fpt
ghec
ghes@ 3.15 3.14 3.13 3.12 3.11 3.10

Key: fpt: Free, Pro, Team; ghec: GitHub Enterprise Cloud; ghes: GitHub Enterprise Server
This table is posted from the Content Changes Table Comment workflow.

@github-actions github-actions bot added the triage Do not begin working on this issue until triaged by the team label Jan 30, 2025
@subatoi subatoi added github apps Content related to GitHub Apps needs SME This proposal needs review from a subject matter expert and removed triage Do not begin working on this issue until triaged by the team labels Jan 30, 2025
Copy link
Contributor

Thanks for opening a pull request! We've triaged this issue for technical review by a subject matter expert 👀

@subatoi subatoi added content This issue or pull request belongs to the Docs Content team waiting for review Issue/PR is waiting for a writer's review labels Jan 30, 2025
Copy link

@felixArbucias felixArbucias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content This issue or pull request belongs to the Docs Content team github apps Content related to GitHub Apps needs SME This proposal needs review from a subject matter expert waiting for review Issue/PR is waiting for a writer's review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Python script for generating a JWT for a github app fails
3 participants