Skip to content

State mismatch in application without database #125

@guushoekman

Description

@guushoekman

I'm getting a state mismatch error when attempting to sign in:

2024-01-19T11:59:28.146571672Z Encountered state mismatch: KbRmQjtvXDGUePkO vs pWhAUmQvHzysfGND
2024-01-19T11:59:28.146609776Z Traceback (most recent call last):
2024-01-19T11:59:28.146615977Z   File "/tmp/8dc18e59ae9b15e/antenv/lib/python3.10/site-packages/identity/web.py", line 151, in complete_log_in
2024-01-19T11:59:28.146620977Z     ).acquire_token_by_auth_code_flow(auth_flow, auth_response)
2024-01-19T11:59:28.146625678Z   File "/tmp/8dc18e59ae9b15e/antenv/lib/python3.10/site-packages/msal/application.py", line 949, in acquire_token_by_auth_code_flow
2024-01-19T11:59:28.146630478Z     response = _clean_up(self.client.obtain_token_by_auth_code_flow(
2024-01-19T11:59:28.146635379Z   File "/tmp/8dc18e59ae9b15e/antenv/lib/python3.10/site-packages/msal/application.py", line 153, in obtain_token_by_auth_code_flow
2024-01-19T11:59:28.146640079Z     return super(_ClientWithCcsRoutingInfo, self).obtain_token_by_auth_code_flow(
2024-01-19T11:59:28.146644480Z   File "/tmp/8dc18e59ae9b15e/antenv/lib/python3.10/site-packages/msal/oauth2cli/oidc.py", line 205, in obtain_token_by_auth_code_flow
2024-01-19T11:59:28.146649180Z     result = super(Client, self).obtain_token_by_auth_code_flow(
2024-01-19T11:59:28.146653681Z   File "/tmp/8dc18e59ae9b15e/antenv/lib/python3.10/site-packages/msal/oauth2cli/oauth2.py", line 541, in obtain_token_by_auth_code_flow
2024-01-19T11:59:28.146658281Z     raise ValueError("state mismatch: {} vs {}".format(
2024-01-19T11:59:28.146662682Z ValueError: state mismatch: KbRmQjtvXDGUePkO vs pWhAUmQvHzysfGND

I can get to the sign in page and go through the signing in process, but I then get the error and am redirected back to /login. I have the example deployed on azure exactly as is except for changing app_config.py. In that file I saw:

# Tells the Flask-session extension to store sessions in the filesystem
SESSION_TYPE = "filesystem"
# Using the file system will not work in most production systems,
# it's better to use a database-backed session store instead.

The thing is that I have a very simple application with which I want to allow a user to sign in and, after they are, run a process for which I don't need a database.

Is there a recommended way to implement this if no database is used?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions