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

Encode via command line cannot set headers #406

Closed
Botono opened this issue Mar 21, 2019 · 4 comments · Fixed by #454
Closed

Encode via command line cannot set headers #406

Botono opened this issue Mar 21, 2019 · 4 comments · Fixed by #454
Labels
hacktoberfest Issues for first-time contributors help wanted

Comments

@Botono
Copy link

Botono commented Mar 21, 2019

There is no way to set headers on a token when encoding via the command line.

Expected Result

Command line arguments should accept some kind of headers input and pass it to encode().

Actual Result

Headers cannot be set.

Reproduction Steps

pyjwt --key=secret --alg='RS256' encode iss=issuer aud=audience sub=subject exp=123456789 headers=foo

headers value will appear in the payload.

You can see that no header value is passed to encode() here:

pyjwt/jwt/__main__.py

Lines 46 to 50 in 6845515

token = encode(
payload,
key=args.key,
algorithm=args.algorithm
)

But encode() supports header information:

headers=None, # type: Optional[Dict]

System Information

$ python -m jwt.help
{
  "cryptography": {
    "version": "2.6.1"
  },
  "implementation": {
    "name": "CPython",
    "version": "3.7.0"
  },
  "platform": {
    "release": "17.7.0",
    "system": "Darwin"
  },
  "pyjwt": {
    "version": "1.7.1"
  }
}
@jpadilla
Copy link
Owner

@Botono wanna put together a pull request?

@justinbaur
Copy link
Contributor

I'd like to help out with this.

@jpadilla
Copy link
Owner

@justinbaur that'd be awesome, thanks!

@jpadilla jpadilla added the hacktoberfest Issues for first-time contributors label Oct 22, 2019
@justinbaur justinbaur mentioned this issue Oct 25, 2019
@benclark0
Copy link

Is there any chance you'd consider making a new version with this change? It'd make my life considerably easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest Issues for first-time contributors help wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants