AuthAlreadyAssociated Exception in Django Social Auth

后端 未结 5 1269
渐次进展
渐次进展 2020-12-30 04:37

After I create a user using say Facebook(let\'s say fbuser) or Google(googleuser). If I create another user through the normal django admin(normaluser), and try logging aga

5条回答
  •  佛祖请我去吃肉
    2020-12-30 05:20

    DSA doesn't logout accounts (or flush sessions) at the moment. AuthAlreadyAssociated highlights the scenario where the current user is not associated to the current social account trying to be used. There are a couple solutions that might suite your project:

    1. Define a sub-class of social_auth.middleware.SocialAuthExceptionMiddleware and override the default behavior (process_exception()) to redirect or setup the warning you like in the way you prefer.

    2. Add a pipeline method (replacing social_auth.backend.pipeline.social.social_auth_user) that logouts the current user instead of raising an exception.

提交回复
热议问题