Credential details:
Username: test
password: test123
This assignment involves setting up a simple username/password authentication system using Redux for state management and Next.js for the front-end and back-end. You will create API endpoints with bearer token authentication and implement a custom useAuthSession
hook to manage the user's session on the client side.
-
Implement the
useAuthSession
Hook:- In
hooks/useAuthSession.ts
, create a custom hook that manages the user's authentication session. - The hook should handle checking if a user is authenticated and fetching user data.
- In
-
Create and Complete the API Endpoints:
- create the required apis
-
Bearer Token Authentication:
- Implement bearer token authentication in your API endpoints.
- Ensure that API requests are secured and only accessible to authenticated users.
const { user } = useAuthSession();
if (user) {
console.log('User:', user.username);
}
Please spend no more than 3-4 hours on this assignment and submit whatever you can complete within that time frame.
- Add validation checks for the login form.
- Show toast notifications for errors and successful login.
- Ensure all your changes are committed.
- Push your changes to a new repository on your personal GitHub account with public access.
- Provide a link to your repository, along with your email and phone number, in the provided Google Form. Do not create pull requests in the shared repository.