本文介绍了将Fusion Table像使用PHP的数据库一样使用,以及在使用oauth时如何关闭提示页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个PHP应用程序,该应用程序仅将Google Fusion Tables用作后台数据库.该应用程序包括一个用于基本安全性的简单登录部分.我下载了google-api-php-client并使用oAuth成功建立了到Fusion Table的连接.没关系.但是,我想摆脱提示屏幕,说我的注册应用程序想要访问Fusion Tables,并要求我允许还是不允许.由于该应用将使用托管在我帐户中的Fusion Table,因此我认为无需向用户提出此问题.您能建议我任何解决方法吗?我计划使其尽可能简单,如果能够在不提示用户任何其他屏幕的情况下完成身份验证,我将非常高兴.

I am developing a PHP application which would use Google Fusion Tables only as a database in the background. The application includes a simple login section for basic security.I downloaded the google-api-php-client and successfully built up a connection to my Fusion Table using oAuth. Thats fine. However, I want to get rid off the prompt screen, that says that my registered application want to access Fusion Tables and asks me to allow or disallow.Since the app would use a Fusion Table being hosted on my account, I think there is no need to ask this question from the user.Can you advise me any workaround to this? I plan to keep it as simple as possible, and would be really happy if there would be a way to get the authentication done without prompting the user with any additional screens.

非常感谢您的帮助!

https://developers.google.com/fusiontables/docs/articles/oauthfusiontables

推荐答案

如果要访问用户Fusion Table,则需要使用您描述的OAuth提示,因此您基本上可以要求用户访问其帐户,以便使用创建表并存储/检索数据.

The OAuth prompt you describe is needed if you want to access a users Fusion Table, so you basically ask the user for access to his account so you can use it to create tables and stores/retrieve data.

但是,在您的情况下,您想授予用户访问使用您的帐户创建的Fusion Tables的权限. Google为此用例引入了所谓的服务帐户.

But in your case you want to give your users access to your Fusion Tables that you created with your account. Google introduced for this use case so called Service Accounts.

所有您需要做的是:

  1. 创建服务帐户(您可以在 Google API控制台->访问API")
  2. 下载私钥
  3. 将服务帐户"访问权授予您表(单击Fusion Tables Web UI中的共享"按钮)
  4. 在代码中使用服务帐户访问Fusion Tables
  1. create a Service Account (you can do this in the Google API console -> "Access API")
  2. download the private key
  3. give the Service Account access to you table (click on the "Share" button in the Fusion Tables web UI)
  4. use the Service Account in your code to access Fusion Tables

不久前,我使用服务创建了一个简单的UPDATE示例帐户.

Some time ago I created a simple UPDATE example using a Service Account.

这篇关于将Fusion Table像使用PHP的数据库一样使用,以及在使用oauth时如何关闭提示页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 04:37