Jump to content

Google OAuth2.0 Server to Server


Bluetooth

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
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.