Azure-Samples/ms-identity-python-webapp

Where are the state session ids stored ?

anjanesh opened this issue · 12 comments

Where are the state and session_state stored ? I want to purge them.

image

rayluo commented

So, you got those from the auth server redirection.

You shouldn't need to worry about purging those data. After a successful login, those auth byproducts will not be stored by this sample app's auth components.

I have 2 django folders with same project on git but different branches.
One works but the other shows "Failed to match request state with session state" after a successful login and I'm not able to debug where it went wrong.

In both I had done pip install git+https://github.com/azure-samples/ms-identity-python-utilities@main

I had to flush the database and re-create it and then only it started working again. I wish I had known where the data is getting linked to.

rayluo commented

I have 2 django folders with same project on git but different branches. One works but the other shows "Failed to match request state with session state" after a successful login and I'm not able to debug where it went wrong.

In both I had done pip install git+https://github.com/azure-samples/ms-identity-python-utilities@main

Hmm, our current conversation (i.e. github issue) was created in the current repo, which is a web app sample that does not use that component.

You may try to port this sample to Django. Feel free to ask questions here along the way.

Does the session data of MS AD get stored in django_sessions directory ?

rayluo commented

Regardless of what web framework you use, the session mechanism of that web framework will be used to store some auth info. And the web app sample in this repo (which you created the current github issue in) will purge it automatically.

P.S.: If you are talking about a different sample (and we have plenty), please create a github issue there so that the subsequent conversation will have a better context.

I don't think this from a different sample as I went through this article - https://learn.microsoft.com/en-us/training/modules/msid-django-web-app-sign-in/3-exercise-register-django-web-app#configure-the-django-web-app-to-use-app-registration-details - which mentions pip install git+https://github.com/azure-samples/ms-identity-python-utilities@main

rayluo commented

I don't think this from a different sample as I went through this article - https://learn.microsoft.com/en-us/training/modules/msid-django-web-app-sign-in/3-exercise-register-django-web-app#configure-the-django-web-app-to-use-app-registration-details - which mentions pip install git+https://github.com/azure-samples/ms-identity-python-utilities@main

That was indeed a different article which aims to guide you building your own "sample" with that helper.

The repository here (which you created this issue in) has its own self-contained Quickstart guide. Please follow the first link inside this repo's README.

I created website and deployed in azure web app services and worked fine 1 week for user. But suddenly 1 date it start giving error Failed to match request state with session state. It works fine in production server which I runs on https but asa I deploy in production it gives error. Also, I access database azure sql directly from django not by creating models. Do you have any other opinion on this to resolve the error?

rayluo commented

It works fine in production server which I runs on https but asa I deploy in production it gives error.

Are you saying that it works on production or not?

Regardless, our general suggestion is to narrow down the possibilities during troubleshooting, by deploying one change at a time and observe which change brings abnormality. Once you can identify a way to reproduce the issue, please create a new github issue here with a specific error message.

Meanwhile, I'm closing this old Q&A.

@rayluo , sorry for re-opening this conversation. We've setup multi-tenant SSO using this library and guide. Our home tenant signs in fine. Our external test tenant signs in fine. But now that clients are starting to use it, they get the "Failed to match request state with session state" error, and I have no clue where that comes from or how to treat it

@rayluo , sorry for re-opening this conversation. We've setup multi-tenant SSO using this library and guide. Our home tenant signs in fine. Our external test tenant signs in fine. But now that clients are starting to use it, they get the "Failed to match request state with session state" error, and I have no clue where that comes from or how to treat it

Please, @eldamir , create a new issue with your app's code snippet of the auth = Auth(...) setup, and we follow up from there. Were you using two different auth objects at the same time?

Meanwhile, I'm locking this old thread.