django-allauth icon indicating copy to clipboard operation
django-allauth copied to clipboard

Custom SocialAccount_Adapter not being used

Open bhavinpatel47 opened this issue 3 years ago • 1 comments

I have a project where I cannot edit the callback URLs. So I implemented a CustomSocialAccountAdapter to change the redirect_uri value. Currently, I only have a debug print statement in it. When I log in using a social login (/accounts/login/) (using Microsoft graph). Nothing is printed in the console and the app behaves as it would without the custom adapter.

# myapp/adapter.py
class CustomSocialAdapter(DefaultSocialAccountAdapter):

    def get_connect_redirect_url(self, request, socialaccount):
        redirect_url = super().get_connect_redirect_url(request, socialaccount)
        print("Using custom adapter")
        return redirect_url
# myproject/settings.py
SOCIALACCOUNT_ADAPTER = 'my_app.adapters.CustomSocialAdapter'

I've tried customizing the ACCOUNT_ADAPTER and it works but the SOCIALACCOUNT_ADAPTER setting doesn't seem to be doing anything.

bhavinpatel47 avatar Apr 12 '22 09:04 bhavinpatel47

You will see it working when you connect a social account to an already existing account.

iarp avatar May 05 '22 13:05 iarp