How do I run some code when a user signs up with python-social-auth in Django?

Viewed 69

I'm using Django and python-social-auth and when a user signs up I want to call the API of another service to add the user to it (think something like Mailchimp). What's the correct way of doing it?

My app has a backend which is API only written in Python and Django, and a frontend written in JavaScript. For the purpose of signing up/in though, there's a link to the backend (api.example.com/social-auth/...) so it ends up being a bit of a hybrid.

After logging in or out, the backend redirects the user back to the frontend, by having this in settings.py:

LOGIN_REDIRECT_URL = env("FRONTEND_URL")
LOGOUT_REDIRECT_URL = env("FRONTEND_URL")

If there's any of my code that's relevant to this question, please let me know and I'll add it. I'm not sure what parts are and I didn't want to do a big dump of all my code. Also, I don't think my code around this issue is particularly good, so I'm happy to change it.

0 Answers
Related