Jump to content

Recommended Posts

Hello fellow developers...

 

I am having a seriously difficult time trying to get this to work...

//OAuth - Here is what I am attempting to use:
https://developers.google.com/api-client-library/php/auth/service-accounts

//The Service I would like to connect to:
https://developers.google.com/beacons/proximity/reference/rest/v1beta1/beaconinfo/getforobserved

 

//What I have so far:

<?php
    session_start();
    require_once 'google/vendor/autoload.php';

    $client = new Google_Client();

    $server_root = str_replace("/public_html", "", $_SERVER['DOCUMENT_ROOT']);

    putenv('GOOGLE_APPLICATION_CREDENTIALS='.$server_root.'/service-account.json');

    $client->useApplicationDefaultCredentials();
    $client->setApplicationName("The App");

    $client->setScopes(['https://www.googleapis.com/auth/userlocation.beacon.registry']);
?>



:/ I am not even sure this even remotely right...however the specific scope said I need to connect to OAuth2 first then call the service... and because it is a dashboard I am trying to create I figured it would be the service to service OAuth that I would need?
 

I am still pretty new to this...so any help would be extremely appreciated,,
Thank-You
Bryan

Link to comment
https://forums.phpfreaks.com/topic/304845-google-oauth20-server-to-server/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.