openid / AppAuth-JS

JavaScript client SDK for communicating with OAuth 2.0 and OpenID Connect providers.
Apache License 2.0
975 stars 162 forks source link

Unable to catch state mismatch error #207

Open martijnkorteweg opened 2 years ago

martijnkorteweg commented 2 years ago

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