Fixing authorization issues
Fixing authorization issues
## About the project
**CarShare MVP** — a web platform for car rental.
- **Backend**: NestJS + Prisma + PostgreSQL
- **Frontend**: Next.js 14 + TypeScript
- **Authorization**: JWT (accessToken + refreshToken)
**Architecture**:
- Backend API: `
- Frontend: (Next.js with reverse proxy to backend)
---
## Problem
After a recent deployment, **critical authorization issues** were identified:
### 1. Logout issue
**Symptoms**:
- User clicks "Logout"
- Message `{"message":"Logged out successfully (client-side)"}` is displayed
- BUT the user remains logged in — the header still shows "Logged in as (admin)"
- After navigating to `/login`, it still shows that the user is logged in
**Expected behavior**:
- After logout, tokens should be cleared from localStorage and cookies
- Header should display "Login" instead of "Logout"
- Navigating to protected pages should redirect to `/login`
### 2. Admin import issue after re-login
**Symptoms**:
- After **clearing the browser cache completely** (Ctrl+Shift+Del)
- Login works successfully (
- Header shows "Logged in as admin
- BUT when trying to import on the page `/import`:
```json
{
"message": "Missing token",
"error": "Unauthorized",
"statusCode": 401
}
```
**Verification**:
- The token exists in the browser: `localStorage.getItem('token')` returns a valid JWT
- Import works through Node.js script (see `test_import_full.js`)
- Import works through bash script (see `test_import_full.sh`)
**Expected behavior**:
- After login, the token should be correctly passed in the request headers
- Import should work from the browser
- On 401 error, there should be an automatic token refresh or redirect to login
---
## Task
**Find and fix authorization issues**:
1. ✅ Analyze the authorization flow (login → token storage → usage → logout)
2. ✅ Fix logout to completely clear the session
3. ✅ Fix token transmission in requests after login
4. ✅ Ensure that import works from the browser
5. ✅ Check that the user is indeed logged out after logout
---
## Acceptance criteria
### Mandatory:
- [ ] **Logout works correctly**: after clicking "Logout", the user is completely logged out
- [ ] **Import works from the browser**: on the page `/import`, an ad from OLX is successfully imported
- [ ] **Tokens are transmitted correctly**: in Network DevTools, `Authorization: Bearer ...` is visible in requests
- [ ] **Handling 401**: on an invalid token, there is a refresh or redirect to login
### Desirable:
- [ ] Code is clean and understandable
- [ ] Comments in places of changes
- [ ] Edge case checks (expired token, network errors)
## Expected time: 2-4 hours
If you handle the task well, we will continue cooperation on the main project.
**Good luck! 🚀**
Client's review of cooperation with Iryna Polyakova
Fixing authorization issuesResponded promptly, did not delay in execution, provided a general assessment, qualified closed the issue.
Freelancer's review of cooperation with Kosta Ed
Fixing authorization issuesClear terms of reference and requirements, pleasant to work with
-
13013 67 0 Hello! I will complete your task quickly and efficiently.
My portfolio: https://freelancehunt.com/ua/freelancer/romas6ka.html#portfolio
Write to me, I will start working today. I will be happy to collaborate with you!
-
447 1 0 Good day!
I am very interested in your offer. I am a FullStack Web Developer with experience in stacks such as PERN, MERN, PEVN, MEVN. I work with modern technologies: Node.js (NestJS), React.js (Next.js), PostgreSQL, and other tools from the JavaScript ecosystem.
Here’s what I can offer you:
- Clean and maintainable code — I use ESLint and Prettier to ensure the code is structured, readable, and easy to maintain;
- Clear architecture — the entire project structure will be logical, without chaos and "tangled forests";
- Modern technologies — using up-to-date solutions on both the frontend and backend;
- Quality and timely development — I work responsibly and adhere to deadlines;
… - Responsive design in pixel-perfect;
- Website localization;
- SEO — optimization for search bots;
- Clear execution of requirements — everything will be implemented according to the provided specifications.
If you are looking for quality, clean architecture, and a responsible performer — I am available!
-
95572 1271 1 10 Hello. I have extensive experience with Next.js/Nest.js. I am ready for collaboration.
-
297 1 Hello!
The goal of this project is to fix critical authentication and session handling issues on the CarShare MVP platform, built using NestJS, Next.js 14, and JWT. I will start by analyzing the entire authorization process to identify failures in saving or revoking tokens, ensuring secure login, proper logout, and reliable token refresh mechanisms. The main focus will be on optimizing token management between the backend and frontend so that the browser correctly transmits and clears tokens. I will also check the seamless operation of the import function with correct authorization headers. With my experience in secure API integration and session debugging, I will provide a clean, stable, and ready-to-use solution.
-
290 2 1 Good evening!
I will help fix issues with token storage and the authorization flow in general.
Over 5 years of experience in web development for both back-end and front-end on different stacks!
Let's discuss the details today and tomorrow there will be a ready solution.
-
307 Hello!
This project is dedicated to diagnosing and resolving critical authorization issues in the CarShare MVP, built using NestJS, Next.js 14, and JWT authentication. As a senior full-stack developer, I will closely monitor the authorization process — from login and token storage to logout and token refresh — to identify and eliminate discrepancies between the frontend storage and backend validation. I will ensure proper token handling in both localStorage and cookies, fix the logout behavior for complete session clearing, and guarantee secure token transmission over protected routes such as /import. Additionally, I will implement proper handling of 401 responses with token refresh or redirects, ensuring a smooth and reliable login process. I can provide a fully tested, stable solution within a few hours or one day, as well as clean, well-commented code ready for long-term support.
Current freelance projects in the category Javascript and Typescript
Development of the AM Mobility platform (car service, parking, insurance, car rental)
5770 USD
We are looking for a team or an experienced Full Stack developer to create the MVP of the AM Mobility platform. AM Mobility is a unified digital ecosystem for motorists, combining in one application and web platform: parking; car service; tire fitting; car wash; car rental;… Javascript and Typescript, Web Programming ∙ 4 days 16 hours back ∙ 112 proposals |
Gsap animations
22 USD
Good day. Corrections need to be made in the current project. A specialist is needed who works well with gsap/lenis. Animation of cards needs to be done. Detailed specifications here:… Javascript and Typescript, Web Programming ∙ 4 days 22 hours back ∙ 21 proposals |
I am looking for a mentor with Claude Code to launch a web project from scratch.Brief about the task: I am a beginner with no programming experience. I have a ready specification for website development (42 pages, Next.js, PostgreSQL). I want to implement it myself using Claude Code - I need a specialist who will set up the environment and teach me how to… Javascript and Typescript, Tuition ∙ 6 days 21 hours back ∙ 19 proposals |
Website design updateIt is necessary to update the design of the existing website using HTML, CSS, JS: refresh the appearance, make it modern and responsive for mobile devices. Smooth animations and interactive elements need to be added. HTML & CSS, Javascript and Typescript ∙ 7 days 14 hours back ∙ 96 proposals |
Consultation and audit of the current project on Odoo 19 Community EditionWe are looking for an Odoo Developer — a solo developer with experience in Odoo 19 Community Edition, including using Claude Code. We need a specialist who has successfully implemented projects in Odoo and practical experience in development using Claude Code. Important: we only… C & C++, Javascript and Typescript ∙ 7 days 20 hours back ∙ 8 proposals |