1

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.

user3684398
  • 99
  • 1
  • 11
  • What do you mean by Google sends you its sign in page? That's the expected behavior. In order to create timeline cards, you have to have permission from Google/the user. Google doesn't trust you with user credentials, so it allows the user to log in on their site. – Jessie A. Morris Jul 10 '14 at 17:04

0 Answers0