Azure-Samples / Azure-Samples/ms-identity-python-samples-common
Intermittent 'Failed to match request state with session state' with Django adaptor
- Linguagem predominante
- Python
- Estrelas
- 47
- Forks
- 42
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
### 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](https://github.com/Azure-Samples/ms-identity-python-django-tutorial/tree/main/1-Authentication/sign-in)
### 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.AQAA',
'session_state': 'aa8b2958-b1c4-4e71-a95c-a682c2180777',
'state': 'c5af71b0-fc95-4d3c-896e-a5c8306d86f7'}
self
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.
Guia de contribuição
Direção de pesquisa
Comece em ms_identity_web/__init__.py, especialmente em _verify_state próximo à linha informada, e compare como o estado da sessão é armazenado e lido na configuração do Django 2.2 usando gunicorn. Reproduza a falha intermitente com o tutorial do Django vinculado, prestando atenção ao Firefox, Edge e Chrome. Está concluído quando o callback não vê mais session_state como None e o teste relevante ou a reprodução confirma que os valores de estado correspondem.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- django, python, ubuntu
- Domínio
- authentication, backend
- Tipo de issue
- Bug
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Status de atividade
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 28/100