Answer the question
In order to leave comments, you need to log in
How to set up uLogin authorization?
Added the simplest authorization code to the site through uLogin
<?php
session_start();
$s = file_get_contents('http://ulogin.ru/token.php?token=' . $_POST['token'] . '&host=' . $_SERVER['HTTP_HOST']);
$user = json_decode($s, true);
//$user['network'] - соц. сеть, через которую авторизовался пользователь
//$user['identity'] - уникальная строка определяющая конкретного пользователя соц. сети
//$user['first_name'] - имя пользователя
//$user['last_name'] - фамилия пользователя
if (strlen($user['network']) > 0 )
{
$_SESSION['auth_user'] = 'Авторизован';
}else {
$_SESSION['auth_user'] = 'Не авторизован';
}
?>
<p><?php echo $_SESSION['auth_user']; ?></p>
<p>Имя - <?php echo $user['first_name']; ?></p>
<script src="//ulogin.ru/js/ulogin.js"></script>
<div id="uLogin" data-ulogin="display=panel;theme=classic;fields=first_name,last_name;providers=vkontakte,odnoklassniki,mailru,facebook;hidden=other;redirect_uri=http%3A%2F%2Fsite.ru%2F;mobilebuttons=0;"></div>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question