From 3739ddcaeefb881c4b752380e1b66261acfc9efa Mon Sep 17 00:00:00 2001 From: tokslaw7 Date: Sun, 9 Jul 2023 00:56:15 +0000 Subject: [PATCH] Added auxstart API call --- www-api/app/Controllers/WrenchApi.php | 12 ------------ www-api/app/Controllers/WrenchOauth.php | 26 +++++++++++++++++-------- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/www-api/app/Controllers/WrenchApi.php b/www-api/app/Controllers/WrenchApi.php index 943528e9..9dd23376 100644 --- a/www-api/app/Controllers/WrenchApi.php +++ b/www-api/app/Controllers/WrenchApi.php @@ -301,18 +301,6 @@ class WrenchApi extends BaseController $in["login_mode"] = MOBILE_LOGIN; } break; - case 'authstart': - $in["action"] = WRENCHBOARD_ACCOUNT_AUXSTART; - if (!isset($in["login_mode"])){ - $in["login_mode"] = MOBILE_LOGIN; - } - break; - case 'authlogin': - $in["action"] = WRENCHBOARD_ACCOUNT_AUXLOGIN; - if (!isset($in["login_mode"])){ - $in["login_mode"] = MOBILE_LOGIN; - } - break; case 'dashdata': $in["action"] = WRENCHBOARD_ACCOUNT_DASHDATA; break; case 'offerslist': $in["action"] = WRENCHBOARD_MOBILE_OFFERSLIST; diff --git a/www-api/app/Controllers/WrenchOauth.php b/www-api/app/Controllers/WrenchOauth.php index db39b673..80582705 100644 --- a/www-api/app/Controllers/WrenchOauth.php +++ b/www-api/app/Controllers/WrenchOauth.php @@ -19,6 +19,15 @@ class WrenchOauth extends BaseController $envID = getenv('ENV_ID'); } + public function endPointList(){ + + $endpoints = [ + 'authstart' => ['POST'], + 'authlogin' => ['POST'], + ]; + + return $endpoints; + } public function apigate(){ log_message('critical', "Oauth-Gate"); @@ -62,7 +71,7 @@ class WrenchOauth extends BaseController http_response_code(404); // tell the user product does not exist echo json_encode([ - 'message' => 'Endpoint not found.', + 'message' => 'HEREEndpoint not found.', 'URI' => $uri, ]); } @@ -108,20 +117,21 @@ class WrenchOauth extends BaseController } - private function prepareOauthEndPointData($endpoint, $in, &$call_backend=true,&$local_out=[]){ + private function prepareOauthEndPointData($endpoint, &$in, &$call_backend=true,&$local_out=[]){ log_message('critical', "Started prepareOauthEndPointData -> ".$endpoint ); switch ($endpoint) { case 'authstart': // may not need to call back end , juet get the configurations switch($in["auth_type"]){ case 'GOOGLE': - log_message('critical', "Reading prepareOauthEndPointData -> ".$endpoint ); - $local_out["GOOGLE_CLIENT_ID"] = $this->getSiteConfigurations("google.google_client_id"); - $local_out["GOOGLE_CLIENT_SECRET"] = $this->getSiteConfigurations("google.google_client_secret"); - break; + log_message('critical', "Reading prepareOauthEndPointData -> ".$endpoint ); + $in["login_channel"] = "990010"; /* LOGIN_GOOGLE */ + $in["GOOGLE_CLIENT_ID"] = $this->getSiteConfigurations("google.google_client_id"); + $in["GOOGLE_CLIENT_SECRET"] = $this->getSiteConfigurations("google.google_client_secret"); + break; } log_message('critical', "prepareOauthEndPointDataL FINAL DATA".serialize($local_out) ); - $call_backend=false; + $call_backend=true; break; case 'authlogin': // not really implemented @@ -135,4 +145,4 @@ class WrenchOauth extends BaseController return $in; } -} \ No newline at end of file +}