How to test nextcloud login

Hello everyone. I would like to monitor if I am able to log into nextcloud, but I am having some trouble in doing so. Does anyone know to write a curl command to log into nextcloud and test if logins are working correctly? I tried this, but I was not able to get the results I wanted.

curl --user my_user:my_password -kvL https://nextcloud.server/index.php/login?redirect_url=&direct=1

I read this here ( Login flow v2) https://docs.nextcloud.com/server/latest/developer_manual/client_apis/LoginFlow/index.html but the wording is not clear, and I am not certain on what action to take. Particularly, where I should send the password is not listed there.

Thank you for your time!

This answers your question right?

I tried it on my server and it worked.

Open devtools, network and start recording everything. Then log in, and copy login request → copy as cURL. You only need the curl 'https://nextcloud.example.com/login', -H 'cookie:xxxxx' and --data-raw 'user=xxx&password=xxx...' rows.

Excellent, ill try it out, thanks!

No problem, hope it works!

Yea, i was able to generate a cookie file, but im unable to verify the login works when using a second curl command. But at least, i have a direction, thanks!

After working on this, and failing for a few hours, I came up with this idea:

curl -u user:password -kX PUT https://nextcloud-server/remote.php/dav/files/login_test/delMe
curl -u user:password -kX GET https://nextcloud-server/remote.php/dav/files/login_test/delMe
curl -u user:password -kX DELETE https://nextcloud-server/remote.php/dav/files/login_test/delMe

This writes a file for a user, then deletes the file. I like this one because it not only tests logging in, but also makes sure the data directory works.

Also, I couldn’t get the other way to work so…