We have 2 systems, one Identity Management System that handles authentication and another is an application (say UserApp) (website) that user access. When a user registers, the user account is created in Identity Management System and UserApp database. The data should be in sync between these 2 systems. So the current code does the following when user registers
- the data is inserted into database (using Entity Framework)
- Account is created in IAM using an API call
Scenarios:
- If the database insert is failed then API is not called
- If database insert is successful, API fails then we delete the record. Question is what needs to be done if the delete fails, then the data is not in sync.
What is the best way to handle? The application is developed in C# with SQL Server.