Skip to content

Conversation

@VidurShah
Copy link
Collaborator

@VidurShah VidurShah commented Sep 4, 2025

Integrate Frontend Auth Service with Login and Signup Pages

Integrated the existing auth service with login and signup forms to enable end-to-end authentication. Added proper error handling, loading states, and session management.

Changes

  • Auth Service: Fixed API endpoints to use /accounts instead of /api/auth and added SignupInput type for extended signup data
  • Login/Signup Pages: Connected forms to auth service functions with error handling and loading states
  • Profile Page: Made authentication-aware with session display and logout functionality
  • Navbar: Added dynamic navigation based on auth status (Profile/Logout vs Sign In/Sign Up)
  • NextAuth Config: Fixed endpoint paths and ensured access tokens are exposed in session

Users can now sign up/login through the forms, which calls the backend API to generate JWT tokens. Refresh tokens are stored in httpOnly cookies, access tokens are available via NextAuth session, and automatic token refresh is handled. Logout clears session and redirects appropriately.

Closes #12

Copy link
Contributor

Copilot AI left a 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 integrates frontend authentication functionality by connecting existing auth service functions to login/signup forms and implementing session-based navigation. The changes enable end-to-end user authentication with proper error handling and loading states.

  • Connected login and signup forms to backend auth service with error handling and loading states
  • Updated navbar to display different options based on authentication status (Profile/Logout vs Sign In/Sign Up)
  • Enhanced profile page to show session information and authentication-aware content

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
client/src/types/dto/accountDto.ts Added SignupInput type for extended signup data
client/src/services/authService.ts Fixed API endpoints and updated signup function parameter type
client/src/lib/authClient.ts Updated base URL configuration with fallback
client/src/components/Navbar.tsx Added dynamic navigation based on auth status with logout functionality
client/src/app/signup/page.tsx Connected signup form to auth service with error handling and loading states
client/src/app/profile/page.tsx Made profile page authentication-aware with session display
client/src/app/login/page.tsx Connected login form to auth service with error handling and loading states
client/src/app/api/auth/[...nextauth]/route.ts Fixed API endpoint paths for NextAuth configuration

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

password: values.password,
};

await signup(signupData, "/profile");
Copy link

Copilot AI Sep 4, 2025

Choose a reason for hiding this comment

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

[nitpick] The signup function is called with a hardcoded redirect URL '/profile'. Consider making this configurable or using a constant to improve maintainability and flexibility.

Copilot uses AI. Check for mistakes.
password: values.password,
};

await login(loginData, "/profile");
Copy link

Copilot AI Sep 4, 2025

Choose a reason for hiding this comment

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

[nitpick] The login function is called with a hardcoded redirect URL '/profile'. Consider making this configurable or using a constant to improve maintainability and consistency with other parts of the application.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

@naasanov naasanov left a comment

Choose a reason for hiding this comment

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

Fuck yeah I love you

@naasanov naasanov merged commit 4ae4806 into main Sep 4, 2025
1 check 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.

Auth System Integration

3 participants