Thanks @snapey I ended creating custom AuthenticatedSessionController, custom NewPasswordController, custom PasswordResetLinkController and custom TwoFactorAuthenticatedSessionController (and created all the Web routes) for it to work as expected.
At the end,
Custom AuthenticatedSessionController store method receives the credentials call the API and depending on the response:
- sets username and custom message in session and then redirects to 'two-factor.login',
- sets username in session and then redirects to 'password.reset'
- stay in login and show the corresponding error message.
Custom AuthenticatedSessionController destroy method just do Auth::logout(), invalidate session, do session token regeneration and redirect to 'login'.
Custom NewPasswordController store method receives the current and new password and call the API to validate current password, validate password policies compliance, if everything is ok call the API to store new password if successful call the API again to simulate a login (to get a new PIN) and finally redirects to 'two-factor.login'.
Custom PasswordResetLinkController store method just get the email call the API to send new temporary password to user if successful redirect to 'login'
Custom TwoFactorAuthenticatedSessionController store method is managing two actions:
- If user clicks on resend PIN submit button it call the API to resend PIN (actually is a new PIN not the same one)
- If user attempt to validate PIN it call the API to validate PIN if successful then it gets the user in my local DB, perform an Auth::login, regenerate session and redirect to 'home.index'.
I also made all the necessary changes in views and removed the added code to JetStreamServiceProvider, ResetUserPassword, UpdateUserPassword, PasswordValidationRules leaving them as originally was. Also i switched off unnecessary features in fortify and jetstream config files.
It is working now.