Skip to content

feat: - Frontend Authorization Update- 7 - #621

Open
Javlon999 wants to merge 2 commits into
EPAM-JS-Competency-center:mainfrom
Javlon999:task-7
Open

Javlon999 wants to merge 2 commits into
EPAM-JS-Competency-center:mainfrom
Javlon999:task-7

Conversation

@Javlon999

@Javlon999 Javlon999 commented May 17, 2026

Copy link
Copy Markdown

Task 7 - Frontend Authorization Update

What was done:

This PR updates the frontend to send Basic Authorization header
when making requests to the Import Service API.


Task 7.3 - Frontend Authorization

  • Updated CSVFileImport.tsx to send Authorization: Basic <token>
    header with every /import request
  • Frontend reads authorization_token from browser localStorage
  • Fixed Import Service API URL in apiPaths.ts

Files Changed:

  • src/components/pages/admin/PageProductImport/components/CSVFileImport.tsx - UPDATED
  • src/constants/apiPaths.ts - UPDATED (fixed import API URL)

How Authorization Works:

  1. User sets token in browser localStorage:
localStorage.setItem('authorization_token', btoa('github_username:TEST_PASSWORD'))
2.Frontend reads token from localStorage on every import request
3.Token is sent as Authorization: Basic <token> header
4. Backend basicAuthorizer Lambda validates the token

localStorage.setItem('authorization_token', btoa('github_username:TEST_PASSWORD'))

Step 2 - Go to Import page:

http://localhost:3000/admin/products
Step 3 - Select a CSV file and click Upload

Expected Results:

 With correct token  file uploads successfully to S3
 With wrong token  403 Forbidden
 With no token  401 Unauthorized

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