Search
 
SCRIPT & CODE EXAMPLE
 

PHP

Gsuite integration in Laravel PHP

//Package :

      "google/apiclient": "^2.0",
      "laravel/socialite": "^4.3",
//Redirection

        $redirectUrl = Config::get('services.google.redirect');                 
        return Socialite::driver('google')->with(["access_type" => "offline", "prompt" => "consent", "redirectUrl" =>  $redirectUrl])->scopes([Google_Service_Directory::ADMIN_DIRECTORY_USER_READONLY])->redirect(); 
//CallBack Get Employee:

        $client = new Google_Client();
        $client->setClientId(config('services.google.client_id'));
        $client->setClientSecret(config('services.google.client_secret'));
        $client->setApplicationName(env('APP_NAME'));
        $client->setDeveloperKey(env('GOOGLE_SERVER_KEY'));
        $client->setApprovalPrompt("consent");
        $client->setAccessType("offline");
        $client->setAccessToken($accessToken);
        
        $service = new Google_Service_Directory($client);

        $optParams = array(
            'customer' => 'my_customer',
            'maxResults' =>500,
            'orderBy' =>'givenName',
            'projection' => 'full',
            'showDeleted'=>true,
            'sortOrder' => 'descending',
            //'query' => 'creationTime=2001-02-15'
            // 'query' => 'isAdmin%3Dtrue'
        );

        if(!empty($pageToken)){
            $pageData = array("pageToken" => $pageToken);
            $optParams = array_merge($optParams, $pageData);
        }
        $results = $service->users->listUsers($optParams);
Comment

PREVIOUS NEXT
Code Example
Php :: laravel get relation camelcase api 
Php :: php hide credit card middle numbers 
Php :: how to click anchor tag in selenium in php 
Php :: preg_replace encoding 
Php :: addcslashes (PHP 4, PHP 5, PHP 7, PHP 8) 
Php :: file_get_contents vs readfile speed 
Php :: 16 digit random password generator php code without function 
Php :: java script clear rectangle 
Php :: Detect Browsers Windows|Linux|Mac|Mobile PHP Code 
Php :: undefine variable $variable in php 
Php :: laravel error not responding well 
Php :: escape class wordpress 
Php :: @parent, @include, @show blade in laravel 
Php :: 0 
Php :: saber value ao escolher combobox php 
Php :: validar rfc en php 
Php :: flask like framework for php 
Php :: numberformatter gujarati 
Php :: laravel check if postback 
Php :: Handling Email Verification Error for APIs 
Php :: cake php 2.x group 
Php :: Unable to create PsySH runtime directory 
Php :: send notification php to PC 
Php :: pass address of array in php 
Php :: Using Cookie Authentication 
Php :: call a class in another class php 
Php :: how to use php in laravel blade 
Php :: how to get only file orginal extension in codeigniter 3 
Php :: The video failed to upload video in laravel in cpanel 
Php :: get data from model in chunks laravel 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =