我需要能够在没有用户输入的情况下将行插入到融合表中。这将是一个可执行文件,每晚运行以确保融合表是相对最新的。 我不需要用户信息...我想要做的就是插入一些行,这样我就可以使用融合表来创建地图了。
在谷歌毫无价值的api样本之后,我一直在尝试不同的方法。我要么最终会从DOTNet库中冒出异常,要么就是我需要获得授权错误。
是否有可能在没有用户干预的情况下做我想做的事情?似乎每个示例仍然希望用户“接受”某些内容,然后向应用程序提供令牌。
赞赏任何示例,评论,指导。
以下是我尝试过的一些代码..似乎我可以将愚蠢的令牌传递到httpwebrequest标头中,我可以将插入放入请求的主体并执行我想要的操作。但我甚至无法连接任何东西。
这只是在断言类中用httpwebrequest错误
惨遭炸弹 AssertionFlowClient provider = new AssertionFlowClient(GoogleAuthenticationServer.Description, cert);
provider.ServiceAccountId = devEmail;
provider.Scope = "https://www.googleapis.com/auth/fusiontables";
var auth = new OAuth2Authenticator<AssertionFlowClient>(provider, AssertionFlowClient.GetState);
return new FusiontablesService(new BaseClientService.Initializer()
{
Authenticator = auth,
ApplicationName = "apptest"
});
这也失败了......
NativeApplicationClient x = new NativeApplicationClient(GoogleAuthenticationServer.Description, clientID, clientSecret);
string token;
try
{
IAuthorizationState s = x.GetClientAccessToken(new string[] { "https://www.googleapis.com/auth/fusiontables" });
token = s.AccessToken;
}
catch (Exception exception)
{
string ex = exception.Message;
}