<div dir="ltr">On Thu, Aug 8, 2013 at 4:50 PM, Michael Spencer <span dir="ltr"><<a href="mailto:spencers1993@gmail.com" target="_blank">spencers1993@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">I'm concidering allowing the app to sync with a backend web service. Is this something I would use Online Accounts for,</blockquote>

<div><br></div><div>Depends on which service you're talking about, I suppose.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

 and where can I find out how to use it?</blockquote><div><br></div><div>That depends. Is the service already supported by UOA? If not, you'll have to write a plugin for it. I once described how to do that here:</div>

<div><br></div><div><a href="http://askubuntu.com/questions/279971/how-to-add-support-for-new-services-to-friends/280389#280389">http://askubuntu.com/questions/279971/how-to-add-support-for-new-services-to-friends/280389#280389</a> (with examples, and a lot of extra info specifically about social networks that probably isn't relevant for you)<br>

</div><div><br></div><div>If UOA already has a plugin, it's not too hard to just connect to UOA and ask for the auth token, although I'm not familiar with how this is done in QML; I've only ever done it in python, personally.</div>

<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"> Also, the service in mind requires an API key by the developer. What is the recommended procedure for using API keys in an Ubuntu Touch app that is open source (GPLv3).<br>

</blockquote><div><br></div><div>Yes, this is a tricky issue. You can never truly hide the API key in an open source application. My understanding of the "best practises" is to do something like this:</div><div>

<br></div><div>1. go to the web service and register two different API keys, one of them your "development" key and one your "production" key (make sure to name the keys clearly). </div><div>2. Take the "development" key and feel free to hard code that right into your source tree and commit it publicly to source control. Leave it this way as you develop and test the features of your application.</div>

<div>3. Set up your build system such that it allows you to override the API key at compile time. How this is done depends on which build system you're using; unfortunately I don't really know how to do it with qmake, but if you're using autotools you'd add a ./configure option that takes a new API key as an argument and then compiles it into your application binary without saving it anywhere publicly.</div>

<div>4. traditionally the packaging for your application is stored in a separate source tree (although this is becoming less and less true over time...), and then in your debian/rules you'd add an override_dh_auto_configure line in order to specify what API key to build into the application when the package is being compiled. </div>

<div><br></div><div>This way if somebody just downloads your main source tree and builds it, they end up using your "development" API key, and if they start abusing the key it shouldn't impact your real live users. The "production" key is still stored in a public source tree, it's just hopefully slightly more obscure / more effort to find than the main source tree.</div>

<div><br></div><div>This is at least how it's done for the API keys used in Ubuntu Online Accounts.</div></div></div></div>