html5 tutorial online accounts should not used default key

Bug #1316639 reported by Kyle Nitzsche
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu Developer Portal
Fix Committed
High
Alberto Mardegan

Bug Description

This tutorial:
http://developer.ubuntu.com/apps/html-5/tutorials/html5-example-online-accounts/

Uses the former approach of using the default built-in OS key.

This means facebook (or whatever upstream api server) identifies the app as owned by the OS. The new model is that the app dev provides their key so that the upstream identifies the app owner appropriately.

To address this, mardy will provide an MR to ubuntu-sdk-tutorials branch that shows how to use the dev key, then kyleN will update the tutorial text.

Mardy, I will assign this bug to you to start with, then we can assign it to me.

Changed in ubuntudeveloperportal:
assignee: nobody → Alberto Mardegan (mardy)
status: New → Confirmed
importance: Undecided → High
Alberto Mardegan (mardy)
Changed in ubuntudeveloperportal:
status: Confirmed → In Progress
Revision history for this message
Alberto Mardegan (mardy) wrote :

Hi Kyle, I linked a branch with the necessary changes. It's not ready for being merged yet, because the key I'm using there it's the one from Shotwell -- I think you told me that you actually did register one key with facebook, so please tell me its client-id and we'll use yours.

Note that the tutorial will have to be modified slightly: the "Run the apps" sections says to run the apps directly, but now that won't work anymore, because we first need to install the .application and .service files in a location where libaccounts can read them. Therefore, for this example the steps now are:

click build .
sudo click install --user=<your-username> ./com.ubuntu.developer.knitzsche.oa-2_0.1_all.click
cd /opt/click.ubuntu.com/com.ubuntu.developer.knitzsche.oa-2/current
ubuntu-html5-app-launcher --www=www

Revision history for this message
Kyle Nitzsche (knitzsche) wrote :

I was mistaken about having registered a FB key. Sorry about that.

And, it is not clear to me from https://developers.facebook.com/ how to create/register a FB key.

I am stuck. Can you please provide some guidance?

I did create an app in the fb dev dashboard, and I can get its App ID which pages like this [1] say *is* the Client ID, and I put that in our service file, built to click, installed and ran on desktop (both with upstart-app-launcher APPID and ubuntu-html5-app-launcher), but it does not work: No Facebook Accounts Enabled. Of course the system fb OA plugins ARE enabled. On dev.fb.com, your FB app can only be of certain types, for example Android, iOS, etc. One type is Website, which seems the only possibility, but that requires you state the Site URL, which I don't have since this is an HTML5 app not a proper web site. So this method of getting a client ID seems wrong.

Also, I now get "No Facebook Accounts Enabled" when running the unmodified fb album browser html5 app from an installed click pkg dir with ubuntu-html5-app-launcher or with upstart-app-launcher (although the app works fine launched with ubuntu-html5-app-launcher from the source dir )

[1] http://stackoverflow.com/questions/15651469/error-500-on-dialog-oauth-api-after-todays-push-at-821

Revision history for this message
Alberto Mardegan (mardy) wrote :

It's correct, the application ID is what you should use as ClientId.
I see the facebook site in Italian, so I might not be giving you the exact terms, but let's try:
- in the "advanced" page, you must enable the "native app" switch.
- in the "protection" section within the "advanced" page, enable the "Client OAuth Login" switch
- in the same section, set the "Valid OAuth redirect URIs" to "https://www.facebook.com/connect/login_success.html"

I think that this should be it. Note that one can use other ways to authenticate to facebook (for instance, a different callback URL), if he modifies the .service file accordingly. One can see the /usr/share/accounts/providers/facebook.provider file as an example: the values used there will be used unless different values are specified in the .service file (which has higher priority).

Revision history for this message
Kyle Nitzsche (knitzsche) wrote :

Hi Mardy,

This worked on trusty Desktop with ubuntu-html5-app-launcher in the installed (opt/click.....) directory, so thanks!

But it does not work when launching the app on Desktop with upstart-app-launch: I still get "No facebook accounts enabled".

Is this what you expected?

(I am about to try on a device after it updates and will report the result here.)

Revision history for this message
Kyle Nitzsche (knitzsche) wrote :

On trusty device image 303 installed as click, I get the same: No facebook accounts enabled.

Is it possible that running from proper click install (whether from device apps page or device upstart-app-launch or on desktop with upstart-app-launch) does not work yet?

Revision history for this message
Alberto Mardegan (mardy) wrote :

I can reproduce the same issue. I wonder if that might be a problem with the apparmor profiles blocking access to ~/.local/share/accounts/...
I'll try to debug this.

Revision history for this message
Kyle Nitzsche (knitzsche) wrote :

Unfortunately, it doesn't work at all anymore. Always "No facebook accounts enabled", even when launched from desktop /opt/click.... with:
$ ubuntu-html5-app-launcher --www=www

Maybe an update change the system?

Revision history for this message
Kyle Nitzsche (knitzsche) wrote :

Also, it appears the 'accounts' policy group is only permitted for "vetted" apps. (Is this only to gate admission into the click app store or is it blocking this app from using OA?)

click-run-checks outputs this:
"error": {
    "security_policy_groups_safe (accounts)": {
      "text": "(MANUAL REVIEW) reserved policy group 'accounts': Can use Online Accounts. This policy group is reserved for vetted applications only in this version of the policy. Once LP: #1230091 is fixed, this can be moved out of reserved status."

Revision history for this message
Kyle Nitzsche (knitzsche) wrote :

So there were some issues that we worked out to get this running, including:

* on trusty the click hook does not exist to install the required service and application files that register the app with OA, so we manually copy them to ./local/share/accounts/applications|services. Their names need to be like this:
  * ~/.local/share/accounts/services/com.ubuntu.developer.knitzsche.oa-2_oa-2.service
  * ~/.local/share/accounts/applications/applications/com.ubuntu.developer.knitzsche.oa-2_oa-2.application

* The user needs to grant access through OA settings to the new app. This results in the app listed in OA (under Facebook account). This fails if the desktop file is not found. OA needs to be told the complete file name of the desktop file (because the .application file does not currently contain the full app ID, it is missing the click pkg version). You can add this to the .application file like this:
<application id="com.ubuntu.developer.knitzsche.oa-2_oa-2">
    <desktop-entry>com.ubuntu.developer.knitzsche.oa-2_oa-2_0.3</desktop-entry>
...
</application>

Revision history for this message
Daniel Holbach (dholbach) wrote :

Is this still relevant or in progress?

Changed in developer-ubuntu-com:
status: In Progress → Incomplete
Changed in developer-ubuntu-com:
status: Incomplete → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.