Fusion Table and Google Accounts

I am trying to use Google Apps accounts to access a Fusion table from an AppENgine Java application. This piece of code is used to get the 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 get the access token, but when I try to execute the CREATE TABLE request, I got:

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

Does a service account work with Fusion tables?

+6
source share
1 answer

I'm not very familiar with Fusion tables, but it is likely that you need either:

1) Grant permission to the service account (the "email address" is in the admin console) to access the table. This is likely to happen through the sample https://developers.google.com/appengine/articles/prediction_service_accounts , which can be useful as a starting point for this process.

2) Log in to the user who has access to the table (or whose data you are trying to access) and allow them to allow access to the application using the three-point OAuth stream. If you gain access to data owned by the end user (for example: joe@gmail.com ), you probably need to do this.

Hope this helps.

+1
source

Source: https://habr.com/ru/post/914250/


All Articles