I am using Auth0 with my Django App for users login/logout authentication. I want a way that when I delete any User from Auth0, the same user account should be deleted from Django Database, likewise if I delete any user account from Django, the attached user from Auth0 should be deleted as well.
How will I achieve this functionality? Any help will be appreciated.
In the first part (delete user from Auth0 first), is that a result of some view you are executing? If so, then add the code to that view to also delete that row from User.
Likewise - if you have a view where you’re deleting a User, then add the code in that view to delete the user from Auth0 as well.
If you’re using the Django admin to delete users, you can add this functionality in a delete action.
Auth0 actually provides a separate Login system that integrates with our Django App and have a separate Database than Django. When we create/register user using Auth0, it automatically gets added in Django Database, but when we delete a user from Auth0 Database, it does not get deleted from Django Database. In their official tutorial to integrate Auth0 with Django App they have not shown how to manage users on both sides at a same time.
But I’m assuming you make some sort of API call to delete the users from Auth0, right? If so, you can also delete your user at the same time you issue the API call to Auth0.
@KenWhitesell I got this reply from a guy on stackoverflow:
For deletion from Auth0 to go to your backend: you can use log streams; listen to the delete event and fire a deletion in your DB
For deletion from your backend to go to Auth0: upon deletion in your DB, call auth0 management-Api to make the deletion in Auth0
Can you explain me this step by step? I am actually new to Auth0 and I don’t know how to implement it.
No, unfortunately I can’t. I’ve never used Auth0 and I really don’t know anything about it. That’s why I offered the ideas that I did - they aren’t tied to anything Auth0 specific.