Hello! This is Click Login

Simple, fast, good system for connecting authorization through social networks to your site. It supports many modules for various CMS systems, connection and installation is also in 1 click as the input itself!

Our team »

Documentation

You can also read on Gitbook

1) To connect a site, get a token for your site - get a token

2) Next, throw users to links like:

https://api.clicklogin.ru/api/auth/[AUTH_TYPE]?domain=[DOMAIN]&redirect=[REDIRECT_URL]&token=[CLICK_LOGIN_TOKEN]

Где:

* After this link, the user will be redirected to the social network and return to your redirect URL with the parameter token_auth ([TOKEN_AUTH]), then you need to check it with request /api/usereq.

💻 PHP/Python/Node or something backend, processing

Processing should be done in your link that you indicated in point 2, [REDIRECT_URL] , use this link to place the processing file and get an answer in it (curl, file_get_contents):

https://api.clicklogin.ru/api/usereq?token=[TOKEN_AUTH]

*Where [TOKEN_AUTH] is the parameter that was passed to you

📜 Nothing is clear? Need an example?

1) Example page login.html , authorization via Vkontakte (vk_auth)

<div class="widgetlogin">
    <p>Авторизация через Вконтакте</p>
    <!-- В ссылке важны параметры : token & domain & redirect -->
    <a href="https://api.clicklogin.ru/api/auth/fb?domain=clicklogin.ru&redirect=https://clicklogin.ru/en/playground/&token=40f9931e4a5fb888f4ce06f7a132f91b141b6ef926cc11cc1fe2d6ffe3e648afedb3afe7fdb6e00b6571a3d75f753eba348889b289b6bdcf6505225add">
        Нажмите чтобы войти!
    </a>
</div>

* Do not worry, a public token is needed only for authorization of your domain in our service.

2) Processing example after the user has redirected to the "redirect" page (php handler) for example: https://example.ru/callback.php


// PHP
function check_auth() {
	$params = array(
		/* Enter your [DOMAIN] token issued - http://clickloginfront.test/ru/addsite */
		'domain' => 'clicklogin.ru', 
		/* Set [TOKEN_AUTH] */
		'token_auth' => $_REQUEST['token_auth']
	);
	/* Get authorization information */
	$query = "https://api.clicklogin.ru/api/usereq?" . http_build_query($params, null, '&');
	$json = @file_get_contents($query);
	if(!empty($json)) {
		$response = (array) json_decode($json,true);
		/* If user exists */
		if(isset($response['success']) && $response['success'] !== false) {
			echo($response['user']['user_id']); /* (int) Идентификатор, обычно бывает всегда*/
			echo($response['user']['email']); /* (string) Почта, обычно бывает всегда*/
			echo($response['user']['first_name']); /* (string) Имя, обычно бывает всегда*/
			echo($response['user']['last_name']); /* (string) Фамилия, обычно бывает всегда*/
			echo($response['user']); /* полностью */
			return (array) $response['user'];
		}
	}
	return array();
}
$user = check_auth();
if(!empty($user)) {
	var_dump($user);
}
else {
	echo 'Something wrong :)';
}
// done :)