Table和Google服务帐户

Table和Google服务帐户

本文介绍了Fusion Table和Google服务帐户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用Google服务帐户从我的AppENgine Java应用程序访问Fusion表。此代码片段用于获取OAuth访问令牌:

  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();

我能够成功获取访问令牌,但是当我尝试执行CREATE TABLE查询时, :

 < HTML> 
< HEAD>
< TITLE>需要登入< / TITLE>
< / HEAD>
< BODY BGCOLOR =#FFFFFFTEXT =#000000>
< H1>需要登录< / H1>
< H2>错误401< / H2>
< / BODY>
< / HTML>

服务帐户是否适用于Fusion Tables?


Grant服务帐户的权限(在管理控制台中找到电子邮件地址)访问表。这可能会通过可能有助于作为此过程的起点。

$ b 2)登录一个有权访问该表的用户(或者您试图访问其数据的用户),并让他们授权访问该应用程序,有条腿的OAuth流量。如果您访问的是最终用户拥有的数据(例如:[email protected]),那么您可能需要这样做。



希望这个帮助。


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?

解决方案

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.

这篇关于Fusion Table和Google服务帐户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 21:18