-
Notifications
You must be signed in to change notification settings - Fork 48
feat: modernize JWT auth (SimpleJWT) + fix CI + docs #209
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
base: main
Are you sure you want to change the base?
feat: modernize JWT auth (SimpleJWT) + fix CI + docs #209
Conversation
- Replace drf-jwt + django-rest-auth with SimpleJWT + dj-rest-auth - Add /api/token/ and /api/token/refresh/; keep /api-token-auth/ legacy alias - Update API auth decorators and add smoke tests Tests: docker compose -f local.yml run --rm django pytest -q codershq/api/tests.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR modernizes the API authentication stack by replacing the deprecated drf-jwt and django-rest-auth packages with their modern equivalents: SimpleJWT and dj-rest-auth. The changes maintain backwards compatibility through a legacy endpoint while introducing new SimpleJWT-based authentication endpoints.
- Replace deprecated JWT authentication packages with SimpleJWT and dj-rest-auth (pinned for django-allauth 0.47.0 compatibility)
- Add modern JWT endpoints (
/api/token/and/api/token/refresh/) while maintaining backwards-compatible/api-token-auth/endpoint - Update API views to use JWTAuthentication class from SimpleJWT
- Add smoke tests for token authentication and legacy endpoint compatibility
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| requirements/base.txt | Updates JWT and REST auth dependencies; also includes hiredis version upgrade (appears unrelated to JWT changes) |
| config/urls.py | Replaces old JWT imports with SimpleJWT views; adds new token endpoints and legacy compatibility view |
| config/settings/base.py | Updates installed apps to use dj-rest-auth; configures SimpleJWT with Bearer/JWT auth header support |
| codershq/api/views.py | Replaces JSONWebTokenAuthentication with JWTAuthentication in view decorators; updates route list |
| codershq/api/auth_views.py | New file implementing backwards-compatible legacy token endpoint that returns both old and new token formats |
| codershq/api/tests.py | New test file with authentication smoke tests covering token obtain, permissions, and legacy endpoint |
| README.md | Adds comprehensive JWT authentication documentation with usage examples |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Replace drf-jwt + django-rest-auth with SimpleJWT + dj-rest-auth - Add /api/token/, /api/token/refresh/ endpoints; keep legacy /api-token-auth/ - Fix CI: bump flake8, add per-file-ignores, resolve lint violations - Update docs: docker compose v2, JWT auth section, clean mdBook build
|
can we proceed @alchatti @vatsalyagoel @Musab0 @naisofly ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 40 out of 60 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| djangorestframework-simplejwt==5.3.1 # https://pypi.org/project/djangorestframework-simplejwt/ | ||
| dj-rest-auth[with_social]==2.2.8 # https://pypi.org/project/dj-rest-auth/ |
Copilot
AI
Jan 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The version djangorestframework-simplejwt==5.3.1 was released in September 2023. As of the current date (January 2026), this version is over 2 years old. Consider upgrading to a more recent version to benefit from bug fixes, security patches, and new features. Check the changelog at https://github.com/jazzband/djangorestframework-simplejwt/releases for any important updates.
| django-cors-headers==3.13.0 # https://pypi.org/project/django-cors-headers/ | ||
| django-rest-auth[with_social]==0.9.5 # https://pypi.org/project/django-rest-auth/ | ||
| djangorestframework-simplejwt==5.3.1 # https://pypi.org/project/djangorestframework-simplejwt/ | ||
| dj-rest-auth[with_social]==2.2.8 # https://pypi.org/project/dj-rest-auth/ |
Copilot
AI
Jan 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The version dj-rest-auth==2.2.8 was released in early 2023. Consider checking for a more recent version to ensure you have the latest bug fixes and security updates. The package is actively maintained, and newer versions may be available.
| - repo: https://github.com/PyCQA/flake8 | ||
| rev: 4.0.1 | ||
| rev: 7.1.1 | ||
| hooks: | ||
| - id: flake8 | ||
| args: ["--config=setup.cfg"] |
Copilot
AI
Jan 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The flake8 version has been upgraded from 4.0.1 to 7.1.1, which is a major version jump (3 major versions). This is a significant upgrade that may introduce new linting rules or behavior changes. Ensure that all team members are aware of this upgrade and that any new linting errors are addressed. Consider documenting this change in the PR description or migration notes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
Summary
Changes
Verification
Backwards Compatibility
How to Test