Skip to content

Update authMiddelware.js - #419

Open
NirbheekKumar wants to merge 1 commit into
harshalhonde21:mainfrom
NirbheekKumar:main
Open

Update authMiddelware.js#419
NirbheekKumar wants to merge 1 commit into
harshalhonde21:mainfrom
NirbheekKumar:main

Conversation

@NirbheekKumar

@NirbheekKumar NirbheekKumar commented Jun 15, 2024

Copy link
Copy Markdown

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

  • Bug fix
  • Feature enhancement
  • Documentation update
  • Other (specify): _______________

Screenshots / videos (if applicable)

[Attach any relevant screenshots or videos demonstrating the changes]

Checklist:

  • I have performed a self-review of my code
  • I have read and followed the Contribution Guidelines.
  • I have tested the changes thoroughly before submitting this pull request.
  • I have provided relevant issue numbers, screenshots, and videos after making the changes.
  • I have commented my code, particularly in hard-to-understand areas.

Additional context:

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

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.
@vercel

vercel Bot commented Jun 15, 2024

Copy link
Copy Markdown

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

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