With the completion of my first milestone for my GSoC project: Nextcloud Integration on Plasma Mobile, plasma mobile accounts settings now enables the users to add their nextcloud accounts via webview.
Well! didn’t accounts setting already provide the method to add nextcloud/owncloud accounts? Yes, this functionality was already implemented by the owncloud plugin in kaccounts-providers project. Then, why did I re-implement the same thing?
As I mentioned, now accounts can be added via webview.
Why using WebView approach for login is better?
This approach is not only more convenient to implement but, it also makes sure that the application never stores the user’s password. The users can be ensured that their credentials can’t be misused.
Add new Account button shows all the accounts plugin options declared by
.provider.in files in providers folder of kaccounts-providers.
On choosing nextcloud option, Nextcloud Wizard shows up. On clicking the
login option, the server address entered by user is checked and then the WebView is initiated.
On the final login the server redirects to a url of the following format:
From this URL login name and password that the application must use to login and store securely is fetched. The control is passed back to the wizard. The user is given option to choose whether or not (s)he wants to synchronize the contacts from the server. This is further facilitated and managed by kaccounts-mobile. Once the login is complete, the username, the password and the other data stored in json object is passed to kaccounts-integration. It manages storing all the accounts and displaying saved accounts on plasma-settings Accounts.