Switch Google login to native client

This commit is contained in:
2022-04-04 01:03:39 -04:00
parent 769e1bc7b1
commit 59f0e75842
5 changed files with 151 additions and 58 deletions
+55 -1
View File
@@ -1,5 +1,60 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
POST /oauth2/v4/token HTTP/1.1
Host: www.googleapis.com
Content-length: 233
content-type: application/x-www-form-urlencoded
user-agent: google-oauth-playground
code=4%2FKxoYTS-jeq5-d6Lv7YvSz9ZrK0pJ_5lZsMExzNC1M0o
&redirect_uri=https%3A%2F%2Foameye.work.wrenchboard.com%2Flogin%2Fauth%2F
&client_id=817021856543-ad9nsjgdpsu2s2jrl63j3ihrv7lbf6ma.apps.googleusercontent.com
&client_secret=aozK_2G8UjaCmLgPPkv9abIm
&scope=
&grant_type=authorization_code
https://oameye.work.wrenchboard.com/login/auth/
?state=HA-R5UG9ZADN2JL8MKPCV736QSIHTEXW4OF01YB
&code=4/0AX4XfWjGtsNysrdFaHZLp6rIOKzZjMj4zmJTQrqu0NOBdEDEuYn9LoBzJoxDFgrw43BqGA
&scope=email+profile+https://www.googleapis.com/auth/userinfo.email+https://www.googleapis.com/auth/userinfo.profile+openid&authuser=0&
prompt=consent
curl -X POST -d 'code=4/0AX4XfWjGtsNysrdFaHZLp6rIOKzZjMj4zmJTQrqu0NOBdEDEuYn9LoBzJoxDFgrw43BqGA&redirect_uri=https%3A%2F%2Foameye.work.wrenchboard.com%2Flogin%2Fauth%2F&client_id=817021856543-ad9nsjgdpsu2s2jrl63j3ihrv7lbf6ma.apps.googleusercontent.com&client_secret=aozK_2G8UjaCmLgPPkv9abIm&scope=&grant_type=authorization_code' https://www.googleapis.com/oauth2/v4/token
*/
if ( ! function_exists('get_google_client'))
{
// Configure Google Client
function get_google_client()
{
// init configuration
$clientID = '817021856543-ad9nsjgdpsu2s2jrl63j3ihrv7lbf6ma.apps.googleusercontent.com';
$clientSecret = 'aozK_2G8UjaCmLgPPkv9abIm';
$redirectUri = site_url('login/auth/');
// create Client Request to access Google API
$client = new Google_Client();
$client->setClientId($clientID);
$client->setClientSecret($clientSecret);
$client->setRedirectUri($redirectUri);
$client->addScope("email");
$client->addScope("profile");
return $client;
}
}
if ( ! function_exists('get_google_login_link'))
{
// Get Google login link
function get_google_login_link()
{
$client = get_google_client();
return $client->createAuthUrl();
}
}
if ( ! function_exists('get_hybridauth_config'))
{
//Hybridauth configuration
@@ -17,7 +72,6 @@ if ( ! function_exists('get_hybridauth_config'))
'secret' => 'aozK_2G8UjaCmLgPPkv9abIm'
) ,
'scope' => 'https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile',
'redirect_uri' => site_url('login/auth/') . '?hauth.done=google'
) ,
'Facebook' => array(