Skip to content

feat(auth): Integrate auth api and session restoration#41

Open
syed-tp wants to merge 13 commits intomainfrom
feat/integrate-auth-api
Open

feat(auth): Integrate auth api and session restoration#41
syed-tp wants to merge 13 commits intomainfrom
feat/integrate-auth-api

Conversation

@syed-tp
Copy link
Collaborator

@syed-tp syed-tp commented Mar 20, 2026

  • Implement AuthRepository with local storage and Dio service.
  • Add session restoration at startup and persistent auth state.
  • Wire auth state into router redirects and login screens.

syed-tp added 2 commits March 20, 2026 12:19
Implement AuthRepository with local storage and Dio service.
Add session restoration at startup and persistent auth state.
Wire auth state into router redirects and login screens.
… and remove `flutter_dotenv` for simplified configuration.
@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly upgrades the application's authentication system by transitioning from a mock-driven setup to a robust, API-backed flow. It establishes persistent user sessions through secure token storage and seamlessly integrates this real-time authentication state with the application's navigation logic and user interface, ensuring a more secure and production-ready user experience.

Highlights

  • API-backed Authentication Flow: Implemented a full API-backed authentication flow, replacing the previous mock-based system. This includes password login, OTP generation, OTP verification, and logout, all handled via network calls.
  • Persistent Session Management: Introduced secure storage for authentication tokens using flutter_secure_storage, enabling persistent user sessions and automatic session restoration upon app startup.
  • Centralized Auth Logic and Error Handling: Created AuthApiService, AuthLocalDataSource, and AuthRepository to centralize authentication logic, network calls, and local token management. A new AuthException class provides structured error handling for authentication-related issues.
  • Router and UI Integration: Integrated the new authentication state into the application's router for dynamic redirects based on user login status and updated login/OTP screens to interact with the new API-driven authentication services.
  • Dependency Updates: Added dio for network requests and flutter_secure_storage for secure data persistence, along with their platform-specific implementations and updated related pubspec.lock and Podfile.lock files.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request successfully integrates a full API-backed authentication flow, replacing the previous mock implementation. It introduces an AuthApiService for network calls, AuthLocalDataSource for secure token storage, and an AuthRepository to manage them. The AuthProvider and GoRouter have been updated to handle asynchronous session restoration and state-based redirects, which is a solid improvement. My feedback focuses on improving type safety in the API service, simplifying state management logic in the AuthProvider, and removing some unused code for better maintainability.

syed-tp added 10 commits March 20, 2026 12:55
- Strictly use 'token' key in Auth API response parsing.
- Update design specs to reflect correct token policy field.
…entication redirects and app initialization.
…te initial location to onboarding, and remove explicit post-logout navigation.
…of user data (`UserDto?`), and update related screens and providers to reflect this change.
…, refactor user repository to profile package, and update related data models and screens.
@syed-tp syed-tp changed the title feat(auth): Integrate api flow and session restoration feat(auth): Integrate auth api and session restoration Mar 23, 2026
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.

1 participant