I'm writing an Ubuntu Touch application in QML. I'd like to integrate with Trello. There are two ways to log into Trello in the API, one of which is OAuth, which I plan on using. What is the best way to do this from QML? I'd prefer not to use a C++ backend, but I am willing to do so if that is the only way.
You could create an account plugin for Trello, so that a Trello account could be created from the "Online Account" panel in the System Settings. The you could use the Ubuntu.OnlineAccounts QML module to login, like this:
This code will get you the OAuth token. In order to create the account in the first place, you need to create the following files:
Given that Trello uses OAuth 1.0 like Flickr and twitter, just create the above files using the twitter or flickr version as a template, and modify them as needed (for the .service file, you could use
And of course, change the other fields (callback URL, client ID and secret) to match those you set when you registered your app with Trello. If all goes well, you'll be able to create a Trello account from the "Online Accounts" panel in the System Settings.
Since the approach that mardy uses isn't actually available to apps under confinement on Ubuntu Touch, it is necessary to do the OAuth dance your self. Essentially, you need to load the login page in a
This example is (more or less) a port of the old QtQuick 1.0 example from Nokia to QtQuick 2.0.