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

Intermittent 'Failed to match request state with session state' with Django adaptor #4

Open
ciarancourtney opened this issue Jun 21, 2021 · 1 comment

Comments

@ciarancourtney
Copy link

ciarancourtney commented Jun 21, 2021

This issue is for a: (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Default Django setup as per Azure-Samples/ms-identity-python-django-tutorial

Any log messages given by the failure

Django error email report snippet:

•	/opt/master/venv/lib/python3.8/site-packages/ms_identity_web/__init__.py in _verify_state 
259.	
260.	            raise AuthSecurityError("Failed to match request state with session state")
261.	
Local Vars
Variable	Value
req_params	{'code': '0.AQ<redacted>AA',
 'session_state': 'aa8b2958-b1c4-4e71-a95c-a682c2180777',
 'state': 'c5af71b0-fc95-4d3c-896e-a5c8306d86f7'}
self	<ms_identity_web.IdentityWebPython object at 0x7fbda61c59a0>
session_state	None
state	'c5af71b0-fc95-4d3c-896e-a5c8306d86f7'

Expected/desired behavior

session_state should not be None and should match state param at https://github.com/Azure-Samples/ms-identity-python-samples-common/blob/main/ms_identity_web/__init__.py#L258

OS and Version?

Django 2.2 using gunicorn on Ubuntu 20.04 EC2

Versions

MSAL 1.12.0

Mention any other details that might be useful

Seems easier to repro using Firefox, but have seen using Edge/Chrome.

@hitanshsingla
Copy link

hitanshsingla commented Aug 11, 2023

Hi, I'm on ms-identity-web (0.16.6), and when I login from two browser windows, then I get the same error.
Can anyone suggest a solution? Thank you!

Steps:

  1. open login page in tab 1 (state is issued)
  2. open login page in tab 2 (new state is issued)
  3. completing login in tab 1 will result in "Failed to match…" error

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

No branches or pull requests

2 participants