Skip to content

Fix DeprecationWarnings by updating key type property usage in tests #1590

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

Merged
merged 1 commit into from
Aug 13, 2025

Conversation

Subham-KRLX
Copy link
Contributor

Fixes #1483.

Replaced deprecated key.key_type with key.kty in test files to remove DeprecationWarnings and ensure compatibility with latest dependencies.

Single change (remove DeprecationWarnings).

@dopry
Copy link
Member

dopry commented Aug 11, 2025

@Subham-KRLX for context, can you link to the documentation regarding the deprecation of key_type here in the issue?

@Subham-KRLX
Copy link
Contributor Author

Hi @dopry, this change is based on the official JSON Web Key spec (RFC 7517, Section 4.1) which mandates "kty" as the standard parameter for key type. The older key_type property in libraries like jwcrypto has been deprecated and now triggers warnings with .kty being the correct standards-compliant attribute. Updating the tests removes these DeprecationWarnings ensures compatibility with the latest dependencies and aligns with the JWK specification.

@dopry
Copy link
Member

dopry commented Aug 12, 2025

I'm familiar with the spec change. I was specifically wondering which one of our dependencies is throwing this deprecation warning and is a mention of the deprecation available in their changelog or release notes.

@dopry dopry force-pushed the fix-deprecation-warnings branch from 10a5cbd to f82bb48 Compare August 12, 2025 17:15
Copy link

codecov bot commented Aug 12, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Subham-KRLX
Copy link
Contributor Author

The warning comes from the jwcrypto library.
Since v1.5 key_type is deprecated in favour of the RFC 7517‑compliant kty attribute as noted in their changelog.

@dopry
Copy link
Member

dopry commented Aug 13, 2025

Awesome thanks for digging that up for me! It actually got deprecated in latchset/jwcrypto@0edf66d, https://github.com/latchset/jwcrypto/releases/tag/v0.9.0

@dopry dopry force-pushed the fix-deprecation-warnings branch from f82bb48 to 74adea0 Compare August 13, 2025 17:40
@Subham-KRLX
Copy link
Contributor Author

I think now its good to go.

@dopry dopry merged commit 0a5ffdb into django-oauth:master Aug 13, 2025
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DeprecationWarning in test_authorization_code.py::TestOIDCAuthorizationCodeHSAlgorithm::test_id_token
2 participants