Nextcloud version (eg, 20.0.5): 21.0.1
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20.04
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.41
PHP version (eg, 7.4): 7.4.3
The issue you are facing:
I want to add a Nextcloud link in my ASP.NET web page (though I don’t think ASP.NET matters for this question). Since I have my own authentication mechanism before users coming to this particular page (I used Nextcloud ocs api), my code already have the user’s username and password for Nextcloud. With this user credential already on hand, how do I open Nextcloud website (the page which shows the files you have in Nextcloud) programmatically without going through the Nextcloud’s login page again?
Otherwise you will need to write your own Nextcloud app which provides a public landingpage. Your Asp.net application would then redirect users to that page and pass a one time use token along with the redirect. Your NC app could then use that token to fetch the login data from the Asp.net application and perform the NC login with that data via the internal NC . If the login succeeds, redirect users to the default app, otherwise redirect them to the login page.
Obviously all communication between NC and your Asp.net app should be via HTTPS and the endpoint on the Asp app should have some kind of authentication so only NC can call it.