Skip to content

feat: gracefully handle expired token exception#69

Merged
jshah4517 merged 3 commits intomasterfrom
gracefully-handle-expired-token
Feb 13, 2026
Merged

feat: gracefully handle expired token exception#69
jshah4517 merged 3 commits intomasterfrom
gracefully-handle-expired-token

Conversation

@jshah4517
Copy link
Copy Markdown
Member

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates Pollcast’s socket ID verification flow to treat expired JWT socket tokens as an authentication failure (401) rather than an unhandled error, and adds functional coverage for the new behaviors.

Changes:

  • Add ExpiredSocketException and throw it when JWT decoding fails specifically due to expiration.
  • Update VerifySocketId middleware to return structured JSON 401 responses for invalid/expired socket IDs.
  • Expand functional tests to cover missing/invalid/expired/malformed JWT socket ID headers and missing id claim cases.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
tests/Functional/VerifySocketIdMiddlewareTest.php Updates expected status codes to 401 and adds new test cases for expired/malformed/missing-claim JWTs.
src/Http/Middleware/VerifySocketId.php Converts socket validation failures into JSON 401 responses; adds special handling for expired tokens.
src/Exception/ExpiredSocketException.php Introduces a dedicated exception type for expired socket JWT tokens.
src/Broadcasting/Socket.php Differentiates expired JWT decode failures from other JWT decode errors.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Http/Middleware/VerifySocketId.php
Comment thread tests/Functional/VerifySocketIdMiddlewareTest.php
Comment thread src/Broadcasting/Socket.php Outdated
@jshah4517 jshah4517 merged commit 1f57d56 into master Feb 13, 2026
6 checks passed
@jshah4517 jshah4517 deleted the gracefully-handle-expired-token branch February 13, 2026 14:57
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.

3 participants