Skip to content

Instantly share code, notes, and snippets.

@filak
Forked from black23/python-jwt-token
Created June 17, 2021 08:01
Show Gist options
  • Save filak/3c0cf2bf98d5eb571f34615a0a8c388e to your computer and use it in GitHub Desktop.
Save filak/3c0cf2bf98d5eb571f34615a0a8c388e to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import datetime
import jwt # pip install pyjwt
app_id = 'SIGLA'
shared_secret = 'add_secret_here'
now = datetime.datetime.utcnow()
token_dict = dict(
iss = app_id,
iat = now,
exp = now + datetime.timedelta(seconds=3600),
app = app_id,
)
token = jwt.encode(token_dict, shared_secret, algorithm='HS256')
print(token)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment