harshalhonde21 / EcommerceSpectastyle

Through this project, we aim to not only learn but also innovate, leveraging the power of the MERN stack to create scalable and efficient solutions. By incorporating cutting-edge warehouse management techniques, we're poised to deliver a comprehensive Ecommerce platform that sets new standards in online retail
https://spectastyle.vercel.app
100 stars 135 forks source link

Update authMiddelware.js #419

Open NirbheekKumar opened 5 months ago

NirbheekKumar commented 5 months ago

Token Extraction:

Ensure the token is extracted correctly from the Authorization header. Typically, tokens are prefixed with Bearer. The split(' ')[1] extracts the actual token part. If the Authorization header doesn't follow the expected format, the code handles it gracefully. Error Handling:

Consistent response format for both missing and invalid tokens. Specific handling for TokenExpiredError and a catch-all for other JWT-related errors.

Related Issue

[Cite any related issue(s) this pull request addresses. If none, simply state “None”]

Description

[Please include a brief description of the changes or features added]

Type of PR

Screenshots / videos (if applicable)

[Attach any relevant screenshots or videos demonstrating the changes]

Checklist:

Additional context:

[Include any additional information or context that might be helpful for reviewers.]

vercel[bot] commented 5 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ecommerce-spectastyle ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 15, 2024 8:33pm
ecommerce-spectastyle-9yav ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 15, 2024 8:33pm