Oauth 服务器上的镜像API身份验证
我正在尝试从iOS应用程序将卡插入我的杯子。为了做到这一点,我有一个iOS应用程序:Oauth 服务器上的镜像API身份验证,oauth,google-mirror-api,aero-glass,Oauth,Google Mirror Api,Aero Glass,我正在尝试从iOS应用程序将卡插入我的杯子。为了做到这一点,我有一个iOS应用程序: NSURL *url = [NSURL URLWithString:@"http://mydomain.com/server.php"]; 然后,myserver.php使用Google的QuickStart项目将卡片发送到my Glass。当我从我的计算机启动这个脚本时,我必须登录,然后它会完美地发送我的卡。然而,当我在iOS应用程序上试用时,谷歌会向我发送它的登录页面 <?php require_o
NSURL *url = [NSURL URLWithString:@"http://mydomain.com/server.php"];
然后,myserver.php使用Google的QuickStart项目将卡片发送到my Glass。当我从我的计算机启动这个脚本时,我必须登录,然后它会完美地发送我的卡。然而,当我在iOS应用程序上试用时,谷歌会向我发送它的登录页面
<?php
require_once 'config.php';
require_once 'mirror-client.php';
require_once 'google-api-php-client/src/Google_Client.php';
require_once 'google-api-php-client/src/contrib/Google_MirrorService.php';
require_once 'util.php';
$client = get_google_api_client();
if (!isset($_SESSION['userid']) || get_credentials($_SESSION['userid']) == null) {
header('Location: ' . $base_url . '/oauth2callback.php');
exit;
} else {
verify_credentials(get_credentials($_SESSION['userid']));
$client->setAccessToken(get_credentials($_SESSION['userid']));
}
$mirror_service = new Google_MirrorService($client);
$new_timeline_item = new Google_TimelineItem();
$new_timeline_item->setText("YoNewFromApp!");
$notification = new Google_NotificationConfig();
$notification->setLevel("DEFAULT");
$new_timeline_item->setNotification($notification);
insert_timeline_item($mirror_service, $new_timeline_item, null, null);
?>
我不知道是否可以通过代码直接验证我的服务器,以便在任何地方调用我的API,而无需登录
有人知道怎么做吗
我是Google Auth的新手,我不懂文档。Thx提前 谷歌向你发送登录页面是什么意思?这是预期的行为。为了创建时间线卡,您必须获得Google/用户的许可。谷歌不信任你的用户凭据,所以它允许用户登录他们的网站。