Hi Alex Rankin
Use authority code flow with PKCE through post
Instead of relying on query strings in redirects, consider switching to post-based authentic flows (if your framework supports it). It is completely avoided from long URL and is a recommended OAuth 2.0 approach to Spa.
If you are using Microsoft's MSAL.JS or any other popular OAuth client library, enable PKCE (proof key for code exchange) and minimize the state passed in query string.
Reduce state size or use browser storageIf you are passing the Custom State Parameter in your authentic request, then try:
State handling in session storage or location,Encoding State Minimum (eg, base 64-encoded json or small identifier) and To avoid large payload or nested objects in the state.This can help keep the final redirected URL under 4096 characters.Store state server-side (advanced)If your app is supported by a serverless API or function app, you can temporarily store complex authentic status on the backend and send a small reference key as Query Param. When redirected, retrieve the full position using that key.
if you have any further concerns or queries, please feel free to reach out to us.