I'm trying to insert card on my glass from an iOS app. In order to do this I've got an iOS app :
NSURL *url = [NSURL URLWithString:@"http://mydomain.com/server.php"];
Then, my server.php send the card to my Glass using the QuickStart project from Google. When I launch this script from my computer, I have to sign in and after it sends my card perfectly. However, when I try it from my iOS App, Google sends me it's Sign In page.
<?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);
?>
I don't know if it's possible to authenticate my server directly by code to call my API from anywhere without signing in.
Anyone know how to do it ?
I'm totally new with Google Auth and I don't understand the doc. Thx in advance.