Custom In-App Login Flow for Nextcloud Android App

Hey everyone! Hope you’re doing well.

I’m looking for some guidance on how to implement a custom login screen for the Nextcloud Android app. Here’s what I’m trying to achieve:

By default, when you want to log in to a Nextcloud account via the Android app, you first input the URL, and then you’re redirected (usually via Chrome) to enter your username and password.

What I’d like to do is create an in-app login flow where the user, right from the start (with no account registered yet), can input the server URL, username, and password—all in a single screen—and the app sends these credentials directly to the login endpoint. If the authentication is successful, the user is logged in without being redirected to a browser.

Additionally, after logging in, the next time the app is opened, the user should see a “Sign in with another account” option or something similar.

Has anyone already done something like this? Or could someone point me in the right direction on how I can implement this flow?

Thanks in advance!

Repository that i was talking about: GitHub - nextcloud/android: 📱 Nextcloud Android app