For a prototype project I've created an Angular 2 application with simple CRUD functionality using Auth0 to handle authentication with a back-end containing a Web API (core), Service and Repository project.
I've chosen to use an Auth0 database to store all the user information (and not an internal custom table) because I didn't see a reason not to and I want to avoid unnecessary complexity.
At this point I need to show all the users in a HTML-table combined with information from my custom database, for example: some users are linked to a project, all users should be shown but only the linked-to-project users should have a button next to the name. For this I use the Auth0 Management API to retrieve all the users. Where would be the best place to join the user and project tables that both exist in different databases (users are only reachable using the external Auth0 Management API.
- Repository: Retrieve all users from the Management API and all projects using SQL, then combine lists.
- Web API: Retrieve all users from the Management API and all projects from the ProjectService, then combine lists.
- Clientside: Retrieve all users from the Management API using Angular 2 and all projects from the ProjectController (internal API), then combine lists using javascript.
- Come to an conclusion that I should merge the Auth0 database to my custom one.
Extra remark: If for example using the Repository to join tables would be the best solution, what should happen when users should be shown on a different page without the need for extra information. I assume that now it is best to call the Management API straight from the client resulting in a situation where the Management API calls are spread through whole the application.