Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fusion Table and Google Service Accounts

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?

like image 499
Kirill Lebedev Avatar asked Apr 26 '12 17:04

Kirill Lebedev


1 Answers

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.

like image 176
Christina Avatar answered Oct 22 '22 05:10

Christina