6

I am trying to use Google Service Accounts to access Fusion table from my AppENgine Java App. This code snippet is used to obtain OAuth access token:

 ArrayList<String> scopes = new ArrayList<String>();
 scopes.add("https://www.googleapis.com/auth/fusiontables");
 DataAccessService fusionTablesService = EnvironmentServic.getEnvironmentService().getService(DataAccessService.class);
 String token = AppIdentityServiceFactory.getAppIdentityService().getAccessToken(scopes).getAccessToken();

I was able to successfully obtain access token, but when I am trying to execute CREATE TABLE query i got:

   <HTML>
    <HEAD>
     <TITLE>Login required</TITLE>
    </HEAD>
    <BODY BGCOLOR="#FFFFFF" TEXT="#000000">
     <H1>Login required</H1>
     <H2>Error 401</H2>
    </BODY>
   </HTML>

Do service account works with Fusion Tables?

Kathryn Hurley
  • 1,094
  • 6
  • 9
Kirill Lebedev
  • 650
  • 4
  • 9
  • I've got the same scenario and thus, problem...would love to know if you found a solution. If I do sooner, I'll let you know my solution :) – AlejandroVK May 07 '13 at 08:03
  • Not really yet. Finally we deside to use BigQuery and custom UI. – Kirill Lebedev May 23 '13 at 03:06
  • Good to know, I managed to use Fusion Tables, altough it has many limitations regarding nº of requests, cells, etc, that make it hard to use for Big Data apps. Still, it is great for creating mashups – AlejandroVK May 23 '13 at 15:13
  • 3 years on, I've hit the exact same problem with FT v2. Did anyone solve it? – scipilot Oct 17 '15 at 07:50
  • Turned out for me - I was using the wrong "scope" (I'd copied the sqlservice one from the OAuth tutorial...) – scipilot Oct 17 '15 at 08:14

1 Answers1

1

I'm not terribly familiar with Fusion Tables, but it is likely that you need to either:

1) Grant permission to the service account (the "email address" is found in the admin console) to access the table. This would probably happen through The sample at https://developers.google.com/appengine/articles/prediction_service_accounts may be helpful as a starting point for this process.

2) Log in a user who has access to the table (or whose data you're trying to access) and have them authorize access for the application using the three-legged OAuth flow. If you're accessing data that is owned by an end user (ex: joe@gmail.com), then you'll probably need to do this.

Hope this helps.

Christina
  • 51
  • 1
  • 1
    Second is not an option, because we need the application itself owns the data. First will not work too, because apllication can not create a new table with service account, so we have not table to grant access to. – Kirill Lebedev May 01 '12 at 18:19