0

I'm trying to expose a .php file which will allow external applications to post cards to users timeline (all users).

My problem is that currently I can only access this page form my browser while I'm logged in to my google account.

How can I make this page authenticate on the server side so every external service can simply post the data it needs to publish?

This is the current authentication code which checks if the user is authenticated and if not - redirects him. I want to get the accessToken on the server side somehow...

 $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']));
}
Doron Goldberg
  • 643
  • 1
  • 9
  • 23
  • 1
    Can you elaborate a bit on what you're trying to do and how you're getting and storing the users' auth now? It sounds like you want a bunch of other services to be able to POST something to yours, and when it does, you'll generate a card to send to all the Glass user's who have signed up for your service. (So you're trying to make a relayer.) Is that correct? – Prisoner Aug 04 '14 at 15:25
  • Exactly. I want that external services will be able to send the cards by calling the .php page – Doron Goldberg Aug 04 '14 at 18:17
  • You may find this useful: https://developers.google.com/api-client-library/php/guide/aaa_oauth2_service – Mars Aug 05 '14 at 23:29
  • Hi, I did that as well but getting an exception. see here: http://stackoverflow.com/questions/25139733/using-a-service-account-to-push-cards?noredirect=1#comment39133993_25139733 – Doron Goldberg Aug 06 '14 at 05:54

0 Answers0