fix(auth): 🐛 Fix auth mechanism after testing and integration#5
Merged
faizanazim11 merged 1 commit intomasterfrom Oct 4, 2025
Merged
fix(auth): 🐛 Fix auth mechanism after testing and integration#5faizanazim11 merged 1 commit intomasterfrom
faizanazim11 merged 1 commit intomasterfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR upgrades Python compatibility to 3.13, modernizes the gRPC refresh service with async lifecycle management, and refactors token handling to use cookies and async Redis operations with orjson serialization.
- Introduces a custom OAuth2 scheme to read tokens from cookies and updates configuration handling.
- Converts gRPC refresh server startup/shutdown to async within FastAPI lifespan and refactors the refresh handler to async with improved logging.
- Refactors Redis connectors and token storage to async patterns and orjson-based serialization.
Reviewed Changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/tp_auth_serverside/pb/refresh_pb2_grpc.py | Bumps generated gRPC version string to 1.75.1. |
| src/tp_auth_serverside/db/memorydb/refresh.py | Adds logging and clarifies exists() check result usage. |
| src/tp_auth_serverside/db/memorydb/login.py | Switches hash value serialization to orjson and adjusts expiration call. |
| src/tp_auth_serverside/db/memorydb/init.py | Moves to async MemDBConnector and initializes connections with asyncio.run at import time. |
| src/tp_auth_serverside/core/handler/refresh_handler.py | Makes refresh RPC handler async, adds logging, and returns Empty responses. |
| src/tp_auth_serverside/core/fastapi_configurer.py | Adds async lifespan for gRPC server, optional dependency injection to token route, and correlation ID middleware. |
| src/tp_auth_serverside/config.py | Replaces OAuth2PasswordBearer with custom scheme, tweaks settings parsing for algorithm/scopes. |
| src/tp_auth_serverside/auth/custom_auth_scheme.py | Introduces cookie-based OAuth2PasswordBearer override. |
| protos/google/protobuf/empty.proto | Adds well-known Empty proto source. |
| .python-version | Updates Python version to 3.13. |
| pyproject.toml | Bumps project version and updates dependencies (Python 3.13, grpcio-tools, jetpack). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces several improvements and refactors to the authentication server, focusing on upgrading Python compatibility, enhancing token handling, modernizing the gRPC refresh service, and improving configuration and dependency management. The changes streamline async operations, improve error handling and logging, and update dependencies for better maintainability and performance.
Python and Dependency Upgrades
.python-versionandpyproject.toml, and bumped project version to0.1.3. Added new dependencies (grpcio-tools,jetpack) and movedgrpcio-toolsout of the dev group. [1] [2] [3]Authentication and Token Handling
CustomOAuth2PasswordBearerto extract tokens from cookies, replacing the default scheme throughout the codebase for improved authentication flexibility. [1] [2] [3]AnnotatedforCookieandHeaderparameters inauth_validator.pyto use correct FastAPI syntax.gRPC Refresh Service Modernization
Redis and Token Storage Improvements
orjson. Also, updated expiration logic for tokens. [1] [2] [3]Protobuf and gRPC Version Updates
google/protobuf/empty.protofile for compatibility with gRPC services. Updated generated gRPC version to1.75.1for protocol buffer files. [1] [2]