Issue. MismatchingStateError with Auth0 in Solara Auth Sample on AWS EC2

Hello,

I'm experiencing a persistent MismatchingStateError with the "Solara authentication sample" from your web using my custom Auth0 credentials on an Amazon Linux AWS EC2 instance.

I'm using the "Solara authentication sample" on this page: https://solara.dev/documentation/advanced/enterprise/oauth

The application functions perfectly on macOS, Raspberry Pi, and Windows, even with a Cloudflare tunnel. However, when deployed on AWS without any proxy or tunnel and accessible directly at port 8765, it throws an error after the Auth0 login sequence.

Here are the details of my setup:
Operating System: Amazon Linux 2023.4.20240429
Python Version: 3.11.9
Solara Version: 1.32.1
Authlib Version: 1.3.0
Starlette Version: 0.37.2

Here's the error message from the server logs:
File "/home/ec2-user/miniconda3/envs/solara_env/lib/python3.11/site-packages/authlib/integrations/base_client/sync_app.py", line 234, in _format_state_params raise MismatchingStateError() authlib.integrations.base_client.errors.MismatchingStateError: mismatching_state: CSRF Warning! State not equal in request and response.

This error occurs after I click the "Login" button; the Auth0 login page appears and seems to work, but once authenticated, I receive an 'Internal Server Error' in the browser.
The Solara server starts without issues and the UI is accessible. I’ve confirmed that port 8765 is open and no network-related issues should be affecting the Auth0 callbacks.

Additionally, I have tested the starlette Auth0 demo on the same AWS server without encountering any problems.

Has anyone faced a similar issue or have any suggestions on further debugging steps? Any help would be greatly appreciated!
Thank you in advance!
Open Authorization can be readily integrated into your Solara applications via the Solara-Enterprise package.
Was this page helpful?