Skip to content
New issue

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

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

Already on GitHub? # to your account

PrivateKeyJWT.headers field is not passed to private_key_jwt_sign function call in PrivateKeyJWT.sign method #515

Closed
lycantropos opened this issue Dec 14, 2022 · 4 comments
Assignees
Labels

Comments

@lycantropos
Copy link

Describe the bug

In commit 49c5556d8b2c7e4b8939e502fefd816bf766dfc3 headers parameter got re-introduced (previously known as header) and it is passed to client_secret_jwt_sign function call in ClientSecretJWT.sign method, but it is not passed to private_key_jwt_sign function call in PrivateKeyJWT.sign method, why is it so?

Also both client_secret_jwt_sign & private_key_jwt_sign eventually call sign_jwt_bearer_assertion which doesn't have headers parameter, but only header, so it looks to be skipped, is it expected?

Expected behavior

headers parameter is passed to private_key_jwt_sign function call in PrivateKeyJWT.sign method

class PrivateKeyJWT(ClientSecretJWT):
    ...
    def sign(self, auth, token_endpoint):
        return private_key_jwt_sign(
            auth.client_secret,
            client_id=auth.client_id,
            token_endpoint=token_endpoint,
            claims=self.claims,
            header=self.headers,
            alg=self.alg,
        )

Environment:

  • OS: OS-independent
  • Python Version: Python-independent
  • Authlib Version: 1.2.0
@dhallam
Copy link
Contributor

dhallam commented Jun 10, 2023

@lepture #552 is ready for review.

@jmacdone
Copy link

I was going nuts trying to add a x5t header for https://learn.microsoft.com/en-us/azure/active-directory/develop/certificate-credentials#assertion-format until I found this. I'm happy to see a PR ready for it. 👀

@jmacdone
Copy link

FWIW, @dhallam's #552 is working for me. With pip install git+https://github.com/dhallam/authlib@bug/515-rfc7523-apply-headers-while-signing I was finally able to get my access_token.

@lepture
Copy link
Owner

lepture commented Jun 18, 2023

#552 is merged.

@lepture lepture closed this as completed Jun 18, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants