revolution/authorize-google-api

Authorize HTTP Client Manager: Google API Driver

1.1.0 2020-03-04 11:57 UTC

This package is auto-updated.

Last update: 2024-04-04 21:01:25 UTC


README

Requirements

  • PHP >= 7.2
  • Laravel >= 5.8

Installation

composer require revolution/authorize-google-api

Usage

    $credentials = [
        'application_name' => '',
        'client_id'        => '',
        'client_secret'    => '',
        'redirect_uri'     => '',
        'scopes'           => [\Google_Service_PhotosLibrary::PHOTOSLIBRARY],
        'access_type'      => 'online',
        'approval_prompt'  => 'auto',
        'prompt'           => 'consent',
    ];

    if (Authorize::driver('google-api')->login($credentials)) {
        /**
         * @var \Google_Client $client
         */
        $client = Authorize::driver('google-api')->client();
        $client->setAccessToken($token);
        $photos = new \Google_Service_PhotosLibrary($client);
    }

LICENSE

MIT
Copyright kawax