CodeIgniter Forums
CI 4 login with google. $client = new Google_Client(); - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=31)
+--- Thread: CI 4 login with google. $client = new Google_Client(); (/showthread.php?tid=76401)



CI 4 login with google. $client = new Google_Client(); - asklinux - 05-10-2020

i have install google api using compose 

composer require google/apiclient:"^2.0"

then its install google api lib in 

vendor/google

to user the lib just load like this

$client = new \Google_Client();

$client->setClientId(''); //Define your ClientID

$client->setClientSecret(''); //Define your Client Secret Key
$client->setRedirectUri(''); //Define your Redirect Uri
$client->addScope('email');
$client->addScope('profile');

ok i find how tu use after install with compose Big Grin
 $client = new Google_Client();
 $client = new Google_Client();
 $client = new Google_Client();[i] $cl[i] $client = new Google_Client();ient = new Google_Client();[/i][/i]


RE: CI 4 login with google. $client = new Google_Client(); - titounnes - 03-24-2021

(05-10-2020, 03:29 AM)asklinux Wrote: i have install google api using compose 

composer require google/apiclient:"^2.0"

then its install google api lib in 

vendor/google

to user the lib just load like this

$client = new \Google_Client();

$client->setClientId(''); //Define your ClientID

$client->setClientSecret(''); //Define your Client Secret Key
$client->setRedirectUri(''); //Define your Redirect Uri
$client->addScope('email');
$client->addScope('profile');

ok i find how tu use after install with compose Big Grin
 $client = new Google_Client();
 $client = new Google_Client();
 $client = new Google_Client();[i] $cl[i] $client = new Google_Client();ient = new Google_Client();[/i][/i]
PHP Code:
<?php

namespace App\Controllers;

use 
App\Controllers\BaseController;
use 
Google\Client as Google_Client;
use 
Google_Service_Oauth2