python-social-auth and impersonate django user
Question: I want to avoid store personal information in database (no last names, no
email). This is my approach to achieve it:

  1. Delegate authentication to social networks authentication service ( thanks to [python-social-auth](https://github.com/omab/python-social-auth) )
  2. Change python-social-auth pipeline to anonymize personal information.

Then I replaced `social_details` step on pipeline by this one:

    
    
    #myapp/mypipeline.py
    def social_details(strategy, response, *args, **kwargs):
        import md5
        details = strategy.backend.get_user_details(response)
        email = details['email']
        fakemail = unicode( md5.new(email).hexdigest() )
        new_details = {
                    'username': fakemail[:5],
                    'email': fakemail + '@noreply.com',
                    'fullname': fakemail[:5],
                    'first_name': details['first_name'],
                    'last_name': '' }
        return {'details': new_details }
    

settings.py

    
    
    SOCIAL_AUTH_PIPELINE = (
        'myapp.mypipeline.social_details',
        'social.pipeline.social_auth.social_uid',
        ...
    

The question:

**Is this the right way to get my purpose?**


Answer: Looks good.

I'm doing something similar to anonymize IP addresses (hash them).

