This commit is contained in:
@@ -2,10 +2,16 @@
|
||||
/*
|
||||
This file can be installed in any service. If done so a user can authenticate with Jakach Auth. Jakach Auth will redirect the user here where their token gets validated, and then they can be logged in to your service.
|
||||
*/
|
||||
$auth_token = $_GET["auth"];
|
||||
$auth_token = $_GET["auth"] ?? "";
|
||||
header('Content-Type: application/json');
|
||||
|
||||
if ($auth_token === '') {
|
||||
echo json_encode(['status' => 'failure', 'msg' => 'Missing auth token']);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Check the auth token against Jakach login API
|
||||
$check_url = "https://auth.jakach.ch/api/auth/check_auth_key.php?auth_token=" . $auth_token;
|
||||
$check_url = "https://auth.jakach.ch/api/auth/check_auth_key.php?auth_token=" . rawurlencode($auth_token);
|
||||
|
||||
// Initialize cURL
|
||||
$ch = curl_init();
|
||||
@@ -47,4 +53,3 @@ if (isset($data['status'])) {
|
||||
echo json_encode(['status' => 'failure', 'msg' => 'Invalid response from authentication server']);
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user