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

PYIC-7189 Invalidate repeat CRI callbacks #2919

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

Conversation

Joe-Edwards-GDS
Copy link
Contributor

@Joe-Edwards-GDS Joe-Edwards-GDS commented Jan 29, 2025

Proposed changes

What changed

Clear the CRI OAuth session id as soon as we receive a successful callback for that CRI.

Why did it change

Previously we would only invalidate the CRI OAuth session id after processing the full CRI callback and a subsequent journey event.

For slow CRIs this can be a significant window of time (5-10s), and the user may get frustrated and either resubmit or refresh the page. This triggers a second CRI callback, however this callback will always fail:

  • If the user resubmits with the same URL, the authorization code is single-use and will receive an error at token exchange
  • If the user resubmits on the CRI side, they will generally have cleared the session, and will return an OAuth error

This means that the second callback will trigger an error scenario, which may complete faster than the first (possibly successful) request, leaving the user on an error screen.

By invalidating the session immediately, we should significantly reduce this window (although it will still exist), and instead produce an INVALID_OAUTH_STATE error, which will render pyi-attempt-recovery, allowing the user to try and recover their state.

The state they recover to will depend on the progress of the first callback:

  • If the first callback is complete, they'll recover to the correct target state
  • If the first callback is still processing, they'll recover to the CRI state, forcing them to revisit the CRI
    • This isn't ideal - but should eventually allow the user to return to IPV Core and recover their journey

@Joe-Edwards-GDS Joe-Edwards-GDS marked this pull request as ready for review January 29, 2025 16:40
@Joe-Edwards-GDS Joe-Edwards-GDS requested review from a team as code owners January 29, 2025 16:40
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