I'm developing an app that will require users to authenticate via their Azure AD account. Customer would like a branded, custom UI, including the login screen. The current library for Azure AD authentication is MSAL.js. Using this library, the recommended flow is that users are redirected to the Microsoft login page (I guess just like they would be to Facebook or Google authentication services) and must enter their password in there if they're not already logged.
According to this, it is possible but not secure or recommended to ask the user for a password in a custom login screen, what I can understand. But why exactly is it safer to ask the user to enter the password in Microsoft sign in portal (or Google, FB, etc.) instead of directly in the app, assuming the app would not store it and would encrypt communications to acquire the token?