[solved] Using login flow with electron

Hey,

i have built a little plugin for KAP Screenrecorder to be able to share generated videos/gif to Nextcloud. This works so far. :slight_smile:

Due to the fact that i implemented username and password authentication which is not a perfect solution i want to use Nextclouds login flow ( https://docs.nextcloud.com/server/14/developer_manual/client_apis/LoginFlow/index.html#obtaining-the-login-credentials )

What i have so far:

  • Open a Window/Webview to /index.php/login/flow with OCS-APIREQUEST and USER_AGENT set
  • User can login and grant permissions according to the login

I struggle getting the nc://... URL from my electron webview.

Is it correct, that i will finally get redirected to a URL starting wirh nc:// ?
From this URL i need to extract the credentials?
What will a call to the API look like when a user is already logged in?

Thanks for your support.

Only need to register a custom protocol for electron. Works as described in the docs. Thanks :slight_smile:

        protocol.registerStringProtocol('nc', function (request, callback) {
            // Do something when protocol is nc://
        }, function (err) {

        });