django-allauth
django-allauth copied to clipboard
Custom SocialAccount_Adapter not being used
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.
You will see it working when you connect a social account to an already existing account.