Fusion Table and Google Service Accounts
Asked Answered
I

1

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?

Iaea answered 26/4, 2012 at 17:34 Comment(5)
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 :)Is
Not really yet. Finally we deside to use BigQuery and custom UI.Iaea
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 mashupsIs
3 years on, I've hit the exact same problem with FT v2. Did anyone solve it?Stumpy
Turned out for me - I was using the wrong "scope" (I'd copied the sqlservice one from the OAuth tutorial...)Stumpy
I
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: [email protected]), then you'll probably need to do this.

Hope this helps.

Instrumental answered 1/5, 2012 at 17:8 Comment(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.Iaea

© 2022 - 2024 — McMap. All rights reserved.