3

I am creating an app in ai2 that connects to one of my fusion tables as a high score datastore.

If I use traditional Oauth2 flow then each user would be presented with an oauth login for their fusiontable, which is not what I want.

I have set up a

Client ID for Android application

in the google developer console which gave me

Client ID   xxxxxxxxx.apps.googleusercontent.com
Redirect URIs   
urn:xxx:xxx:xxx
http://localhost
Package name    appinventor.ai_xxxxxxxx.xxxxxxxx
Certificate fingerprint (SHA1)  12:34:56 etc
Deep linking    Disabled

What I want is for my app to connect to my fusiontable using my credentials regardless of which device or which user. How do I do that?

Thanks

khany
  • 1,167
  • 15
  • 33
  • I have worked this out (finally) and will post an answer once I have documented the whole process. – khany May 05 '14 at 20:52
  • you now also can use a service account to access fusiontables from within **App Inventor**, more see the [documentation](http://ai2.appinventor.mit.edu/reference/components/storage.html#FusionTablesControl) – Taifun Oct 12 '14 at 20:15
  • Hi did you figure this out? – Mixstah Sep 25 '15 at 18:53

1 Answers1

1

This document is a very simple and straight-forward guide to creating a fusion table for your app.

https://docs.google.com/document/d/1HifuZqz5xu0KPS-e4oUv-t-nQoUQ8VMNyh_y6OjZkc0/pub

Steps:

First, you have to create a project at console.developers.google.com.

Then go to the API manager in the menu. Search for and enable the fusion tables API.

Now create a service account key. You may have to look in the credentials menu for this setting. Choose "enable Google apps-wide delegation". A service account is a localized email address that your app can use when you share the fusion table with that account. It provides more security than the anyone with the link can edit setting.

Now go to New Credentials > Service account key. Select P12, and the file will automatically download. If the name of the file has spaces, remove them.

Next, create a google fusion table.

Now share the table with the service email you created. Set the permission to Can Edit. Uncheck the notify box and hit Share.

Now, go to App Inventor. You need:

  • Your Service Account Email address (also called service account ID)
  • Service Account key file (.p12)
  • Fusion Table ID code (don't worry about this yet)

First, upload the key file.

In the fusion tables component property menu, set the KeyFile property to the key file. Copy the email address you created earlier and paste it in the ServiceAccountEmail property. Check the Use Service Authentication box.

Last thing: In the fusion table, go to File > About This Table. Copy the table Id. When you do operations with the table, you will need this id. You can store it in a variable if you want.

This property means that you can share and use multiple different tables with the same service account. Just share the other table(s) you will use with the service account and use that table's id when you do operations with that table.

John Locke
  • 185
  • 1
  • 17
  • Welcome to Stack Overflow! Whilst this may theoretically answer the question, [it would be preferable](//meta.stackoverflow.com/q/8259) to include the essential parts of the answer here, and provide the link for reference. – 3D1T0R Jul 28 '18 at 00:19
  • @3D1T0R Thank you for explaining. I will edit my post and try to provide a better answer. – John Locke Jul 28 '18 at 00:49