Skip to content

Commit 13a2b44

Browse files
authored
Merge 480f89d into 2aa1f23
2 parents 2aa1f23 + 480f89d commit 13a2b44

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

content/apps/creating-github-apps/authenticating-with-a-github-app/generating-a-json-web-token-jwt-for-a-github-app.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,16 @@ puts jwt
8484

8585
{% note %}
8686

87-
**Note:** You must run `pip install jwt` to install the `jwt` package in order to use this script.
87+
**Note:** You must run `pip install PyJWT` to install the `jwt` package in order to use this script.
8888

8989
{% endnote %}
9090

9191
```python copy
9292
#!/usr/bin/env python3
93-
from jwt import JWT, jwk_from_pem
94-
import time
9593
import sys
94+
import time
95+
96+
import jwt
9697

9798

9899
# Get PEM file path
@@ -117,7 +118,7 @@ else:
117118

118119
# Open PEM
119120
with open(pem, 'rb') as pem_file:
120-
signing_key = jwk_from_pem(pem_file.read())
121+
signing_key = pem_file.read()
121122

122123
payload = {
123124
# Issued at time
@@ -132,8 +133,7 @@ payload = {
132133
}
133134

134135
# Create JWT
135-
jwt_instance = JWT()
136-
encoded_jwt = jwt_instance.encode(payload, signing_key, alg='RS256')
136+
encoded_jwt = jwt.encode(payload, signing_key, algorithm='RS256')
137137

138138
print(f"JWT: {encoded_jwt}")
139139
```

0 commit comments

Comments
 (0)