Unable to catch state mismatch error
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1k
- Forks
- 165
- PR merge metrics
- No merged PRs in 30d
Description
Expected Behavior
[REQUIRED] Describe expected behavior
When calling completeAuthorizationRequestIfPossible I would like to be able to catch the error where the current request state mismatches the returned state. There is already an error response in the notifier that could easily be used for this, and resolving completeAuthorizationRequest with {request, null, error} would solve this issue.
Describe the problem
[REQUIRED] Actual Behavior
When calling completeAuthorizationRequestIfPossible and the state is mismatched, there is a console log that this happened but no way to actually act on this outcome.
[REQUIRED] Steps to reproduce the behavior
In my implementation this issue came up when a user had multiple tabs open and they tried to sign in to each of the tabs. This caused the tabs that are mismatched to be stuck. To replicate the issue simple attempt a login with your favorite provider but before submitting the login change the current appauth_current_authorization_request to something else. This will log Mismatched request (state and request_uri) dont match. but nothing else happens.
[REQUIRED] Environment
- AppAuth-JS version: 1.3.1
- AppAuth-JS Environment (Node, Browser (UserAgent), ...): Latest Chrome
- Source code snippts (inline or JSBin)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at completeAuthorizationRequestIfPossible and trace its call to completeAuthorizationRequest and the notifier's existing error response. Verify the mismatched-state path gives callers a way to handle the outcome, including the request and error, and confirm the behavior for the multiple-tab scenario described in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- authentication
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100