GSoC/2018/StatusReports/ThanhTrung

From KDE Community Wiki

digiKam: Web Services tools authentication with OAuth2

digiKam is a desktop application for photos management. digiKam provides a wide range of plugins for exporting photos to web services (e.g dropbox, flickr, facebook, etc.) alowing users to easily upload their photos to cloud storage services or share photos on social networks.

Current export tool authentication process makes it far from easy-to-use for users. In addition, authentication protocols varies much for each web service, generating many difficulties for implementation and code maintaining. Hence, this project is aimed to resolve those problems by porting authentication flow with O2 library, in order to make digiKam export tool more user-friendly and more flexible for development and maintenance.

Mentors : Maik Qualmann, Gilles Caulier

Project Goals

  • Port export plugins with O2 library.
  • Factor codes of new wizard for export plugins.
  • Accomplish new wizard with features for photo processing before uploading.

Work report

Coding period : Phase one (May 14th to June 15th)

This phase is to port 3 digiKam web services : Google, Facebook and Smugmug to O2. It is required to change the authentication flow but still preserve main functionalities. In general, work for this part is nearly done, except some minor existant bugs to be resolved.

According to my initial plan, I must also have finished Youtube Uploader by this time. However, since porting these web services to O2 is more important and Youtube Uploader can be finished in phase two of project, when i will be working on code factorization for other web services, the whole first part of project was then spent on porting to O2.

Below is my project status.

Smugmug

Resolved :

  • Authentication with OAuth2
  • All methods are ported to new APIs (v2)
  • Anonymous mode is removed
Google Drive

Resolved :

  • Authentication with OAuth2
  • Export is ported to keep compatibility with O2
Google Photo

Resolved :

  • Authentication with OAuth2
  • All methods are ported to Google Photo APIs (to replace current methods based on Picasa APIs)


Unresolved :

  • Photos import from Google Photo are not visualized in digiKam
  • Cannot export to albums not created by digiKam (lack of authorization scope from Google Photo APIs)
Facebook

Resolved :

  • Authentication with OAuth2
  • All methods are ported to new API (v3) and kept compatibility with O2


Unresolved :

  • Cannot create album by digiKam
  • App review to put digiKam public mode


Coding period : Phase two (June 15th to July 13th)

In this phase, I continue working on each web service separately to fix bugs and prepare for beta release of digiKam 6.0.0. Moreover, the main part of this phase is factorize codes for web services.

Indeed, once web services use OAuth2 as protocol for authentication and O2 as library for OAuth2 implementation, codes begin repeatable, especially in talker.cpp, where the authentication flow has been implemented so far. Moreover, future vision for web services' authentication is using QtNetworkAuth as a pure Qt solution, which enhances the portability of digiKam and facilitates development and maintainability. Therefore, code factorization is an essential step in digiKam todo list.

Concretely, factorization is divided in two parts: authentication flow, and export tool UI. It has to be mentioned that Gilles Caulier, one of my mentors, has prepared a common wizard for export tool. Thus, I took it as inspiration for UI factorization.

Authentication flow factorization

My solution is to define a base class for talker of each web service. Indeed, each web service currently has a class called talker handling all the communication with authentication server for access token exchange, API calls and API response processing. Therefore, the idea is to group common codes in a class, which also defines the standard authentication flow for each web service.

That class contains a method to control the flow and virtual methods for API calls and parsing API responses, which will be reimplemented depending on API specifications.

Important Links

Proposal Link

Project Proposal

Git dev branch

gsoc18-exporttools-o2

Contacts

Email: [email protected]

Github: TrungDinhT