Can we identify the application that is calling the login function when using a Custom Database?

Ready to post? :mag: First, try searching for your answer.
I have 5 applications in my test tenant. We use a Custom Database for Authentication, but we really need each of the 5 applications to connect to a different database we have on premise related to each application. Is that possible? I have spent a few hours trying to find a way to alter the login script to call a different API based on the client application, but I have not find any way within the script to identify the application that has called the login function.