Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update authMiddelware.js #419

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

NirbheekKumar
Copy link

@NirbheekKumar NirbheekKumar commented Jun 15, 2024

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.
Copy link

vercel bot commented Jun 15, 2024

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.

None yet

1 participant