Guides - TOKEN - Login (frontend)
TOKEN - Login (frontend)
If you already have a login on your website, e.g. in the form of an Intranet, you can with TOKEN-Log avoid that your customers/users must log in double. The Token-login is found and activated under advanced settings. The feature works by your system calling up the system via secure connection (https: //), from an approved IP, with information about the user you would like to log in. Depending on your wishes, you can adjust the following:
The following is an example of the use of TOKEN-Log, written in PHP as GET.
|
$tokenLoginUrlAdd = "";
if (logic for user is logged in here, eg. session check){
$tokenUrl = "https://app.geckobooking.com/site/token.php?do=tokenLogin&tk=[INSERT_TOKENKEY_1_HERE]&tk2=[INSERT_TOKENKEY_2_HERE]&id=[INSERT_AGREEMENT_NUMBER_HERE]";
$tokenUrl .= "&CustomerNumber=".urlencode($MyLocalCustomerNumber);
$tokenUrl .= "&CustomerName=".urlencode($MyLocalCustomerName);
$tokenUrl .= "&CustomerAddress=".urlencode($MyLocalCustomerAddress);
$tokenUrl .= "&CustomerPostalCode=".urlencode($MyLocalCustomerPostalCode);
$tokenUrl .= "&CustomerCity=".urlencode($CustomerCity);
$tokenUrl .= "&CustomerEmail=".urlencode($MyLocalCustomerEmail);
$tokenUrl .= "&CustomerTelephone=".urlencode($MyLocalCustomerPhone);
$tokenUrl .= "&CustomerMobile=".urlencode($MyLocalCustomerMobile);
$tokenUrl .= "&CustomerSSN=".urlencode($MyLocalCustomerSocialSecurityNumber);
$result = file_get_contents($tokenUrl);
if ($result != "false"){
$tokenLoginUrlAdd = "&token=".$result;
}
}
echo "<script type="text/javascript" src="https://app.geckobooking.com/site/iframe.js?icCode=[INSERT_ICCODE_HERE]".$tokenLoginUrlAdd.""></script>";
Example using POST vars and cUrl, and thus also makes it possible to transmit information with the BEF spaces. Using POST is recommended, as it can handle longer text strings. |
if (logic for user is logged in here, eg. session check){
$token1 = "[INSERT_TOKENKEY_1_HERE]";
$token2 = "[INSERT_TOKENKEY_2_HERE]";
$id = "[INSERT_AGREEMENT_NUMBER_HERE]";
$fieldArr = array(
"do" => "tokenLogin",
"tk" => $token1,
"tk2" => $token2,
"id" => $id,
"CustomerNumber" => $MyLocalCustomerNumber,
"CustomerName" => $MyLocalCustomerName,
"CustomerAddress" => $MyLocalCustomerAddress,
"CustomerPostalCode" => $MyLocalCustomerPostalCode,
"CustomerCity" => $CustomerCity,
"CustomerEmail" => $MyLocalCustomerEmail,
"CustomerTelephone" => $MyLocalCustomerPhone,
"CustomerMobile" => $MyLocalCustomerMobile,
"CustomerSSN" => $MyLocalCustomerSocialSecurityNumber,
"CustomerPassword" => $MyLocalPassword
);
// Hvis tekst til BEF felter
if ($includeBEF) {
// example - $bef[INSERT_BEFID] = $yourvalue;
$bef[99999999] = "Test value A";
$bef[88888888] = "Test value B";
foreach ($bef as $k => $v) {
$bef[$k] = utf8_encode($v);
}
$fieldArr["bef"] = json_encode($bef);
}
foreach($fieldArr as $key => $value) {
$fieldStr .= $key."=".urlencode($value)."&";
}
rtrim($fieldStr, '&');
$ch = curl_init();
curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch,CURLOPT_URL, "https://app.geckobooking.com/site/token.php");
curl_setopt($ch,CURLOPT_POST, count($fieldArr));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fieldStr);
$result = curl_exec($ch);
if ($result != "false"){
echo "<script type="text/javascript" src="https://app.geckobooking.com/site/iframe.js?icCode=[INSERT_ICCODE_HERE]".$tokenLoginUrlAdd.""></script>";
}
//close connection
curl_close($ch);
}