1. from social_auth.backends.pipeline.social import social_auth_user
  2. from social_auth.backends.google import GoogleBackend
  3. def migrate_from_openid(backend, **kwargs):
  4. """Attempt to attach google openid clients to google-oauth2 clients"""
  5. if backend.name != 'google-oauth2':
  6. return None
  7. ret = social_auth_user(backend=GoogleBackend(), **kwargs)
  8. if ret.get('social_user', None):
  9. ret['social_user'].provider = 'google-oauth2'
  10. return ret
  11. #
  12. # Add migrate_from_openid to the SOCIAL_AUTH_PIPELINE (copy and paste)
  13. # after social_auth_user but before get_username
  14. #
 
 

116

 

1307

Pasted Text #659

Migrate Google OpenID to OAuth2.

Setup your OAuth2 and then add this pipeline into a module and add to your settings.

PasteBin

Lines
16
Words
55
Size
607 bytes
Created
Type
text/x-python
Public Domain (PD)
Please log in to leave a comment!