Connect App using OAuth2 to Nextcloud

For an existing Nextcloud, we need to add an option to login through the app which uses the Oauth2 method. The current app that we’re are using, uses the Microsoft login.

What we want is to add a button to the login screen, which says “Login with your business account”.
This button then redirects you to the app which uses the oauth2 method to login you in. When you are logged in, redirects you back to the Nextcloud.
Is that possible ?

most likely you are looking for sociallogin app. It can be used to authenticate on Nextcloud using external identity provider