谷歌api访问谷歌帐户信息

时间:2013-12-05 01:11:14

标签: google-app-engine google-calendar-api

我有一个非常快速的问题,我注意到当您注册市场应用时,它会要求获得访问联系人,日历等的许可。

这在哪里以及如何控制?我知道有从这些来源检索数据的API,但权限等等呢?

1 个答案:

答案 0 :(得分:1)

为Google Apps Marketplace构建的应用程序可以使用双向OAuth访问Google API。 Marketplace应用程序在其应用程序清单中包含 API范围。当应用程序安装在域中时,域管理员必须明确批准对声明的范围的访问权限。这使应用程序可以使用应用程序的双方OAuth使用者密钥和密钥访问该域所需的范围。

描述需要访问Google Calendar API的应用程序的示例清单文件:

    <?xml version="1.0" encoding="UTF-8" ?>
<ApplicationManifest xmlns="http://schemas.google.com/ApplicationManifest/2009">
  <!-- Support info to show in the marketplace & control panel -->
  <Support>
    <!-- URL for application setup as an optional redirect during the install -->
    <Link rel="setup" href="http://www.example.com/google/setup.php?domain=${DOMAIN_NAME}" />

    <!-- URL for application configuration, accessed from the app settings page in the control panel -->
    <Link rel="manage" href="http://www.example.com/google/admin.php?domain=${DOMAIN_NAME}" />

    <!-- URL explaining how customers get support. -->
    <Link rel="support" href="http://www.example.com/google/support.php" />

    <!-- URL that is displayed to admins during the deletion process, to specify policies such as data retention, how to claim accounts, etc. -->
    <Link rel="deletion-policy" href="http://www.example.com/google/deletion-policy.php" />
  </Support>

  <!-- Name and description pulled from message bundles -->
  <Name>AppTest</Name>
  <Description>A simple application for testing the marketplace</Description>

  <!-- Show this link in Google's universal navigation for all users -->
  <Extension id="navLink" type="link">
    <Name>AppTest</Name>
    <Url>http://www.example.com/home.php?from=google&amp;domain=${DOMAIN_NAME}</Url>
    <!-- This app also uses the Calendar API -->
    <Scope ref="calendarFeed"/>
  </Extension>

  <!-- Declare our OpenID realm so our app is white listed -->
  <Extension id="realm" type="openIdRealm">
    <Url>http://www.example.com</Url>
  </Extension>

  <!-- Need access to the Calendar feed -->
  <Scope id="calendarFeed">
    <Url>http://www.google.com/calendar/feeds/</Url>
    <Reason>This application shows the next Calendar event.</Reason>
  </Scope>

 </ApplicationManifest>