Added auxstart API call

This commit is contained in:
tokslaw7
2023-07-09 00:56:15 +00:00
parent 1048638557
commit 3739ddcaee
2 changed files with 18 additions and 20 deletions
-12
View File
@@ -301,18 +301,6 @@ class WrenchApi extends BaseController
$in["login_mode"] = MOBILE_LOGIN; $in["login_mode"] = MOBILE_LOGIN;
} }
break; 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; case 'dashdata': $in["action"] = WRENCHBOARD_ACCOUNT_DASHDATA;
break; break;
case 'offerslist': $in["action"] = WRENCHBOARD_MOBILE_OFFERSLIST; case 'offerslist': $in["action"] = WRENCHBOARD_MOBILE_OFFERSLIST;
+18 -8
View File
@@ -19,6 +19,15 @@ class WrenchOauth extends BaseController
$envID = getenv('ENV_ID'); $envID = getenv('ENV_ID');
} }
public function endPointList(){
$endpoints = [
'authstart' => ['POST'],
'authlogin' => ['POST'],
];
return $endpoints;
}
public function apigate(){ public function apigate(){
log_message('critical', "Oauth-Gate"); log_message('critical', "Oauth-Gate");
@@ -62,7 +71,7 @@ class WrenchOauth extends BaseController
http_response_code(404); http_response_code(404);
// tell the user product does not exist // tell the user product does not exist
echo json_encode([ echo json_encode([
'message' => 'Endpoint not found.', 'message' => 'HEREEndpoint not found.',
'URI' => $uri, '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 ); log_message('critical', "Started prepareOauthEndPointData -> ".$endpoint );
switch ($endpoint) { switch ($endpoint) {
case 'authstart': case 'authstart':
// may not need to call back end , juet get the configurations // may not need to call back end , juet get the configurations
switch($in["auth_type"]){ switch($in["auth_type"]){
case 'GOOGLE': case 'GOOGLE':
log_message('critical', "Reading prepareOauthEndPointData -> ".$endpoint ); log_message('critical', "Reading prepareOauthEndPointData -> ".$endpoint );
$local_out["GOOGLE_CLIENT_ID"] = $this->getSiteConfigurations("google.google_client_id"); $in["login_channel"] = "990010"; /* LOGIN_GOOGLE */
$local_out["GOOGLE_CLIENT_SECRET"] = $this->getSiteConfigurations("google.google_client_secret"); $in["GOOGLE_CLIENT_ID"] = $this->getSiteConfigurations("google.google_client_id");
break; $in["GOOGLE_CLIENT_SECRET"] = $this->getSiteConfigurations("google.google_client_secret");
break;
} }
log_message('critical', "prepareOauthEndPointDataL FINAL DATA".serialize($local_out) ); log_message('critical', "prepareOauthEndPointDataL FINAL DATA".serialize($local_out) );
$call_backend=false; $call_backend=true;
break; break;
case 'authlogin': case 'authlogin':
// not really implemented // not really implemented
@@ -135,4 +145,4 @@ class WrenchOauth extends BaseController
return $in; return $in;
} }
} }