python-social-auth icon indicating copy to clipboard operation
python-social-auth copied to clipboard

Customize session value/content

Open Gocht opened this issue 10 years ago • 1 comments

I am trying to find out when/where is session written. I am using Redis to store session and it's working properly, but I'd like to avoid sending a user to template, I want to write a custom session, instead of the default and return a JSON with the user data if everything went right I have tried with pipelines but I can't find where session is written. Is this possible?

Gocht avatar Mar 18 '16 17:03 Gocht

The strategies are the responsible for defining the needed methods to access the current framework session capabilities (https://github.com/python-social-auth/social-core/blob/b78159cbd45ff1c281e92d7756ab03c22f7ded8f/social_core/strategy.py#L182-L192), if that's what you are looking for, then you need to define you custom strategy (you can inherit from the already implemented one for the framework you use), and define those three methods with your desired mechanism. Then set the setting SOCIAL_AUTH_STRATEGY to be an import path to your custom class.

omab avatar Dec 26 '16 12:12 omab