I have setup facebook authentication using php and it goes something like this first getting the authorization here :
https://graph.facebook.com/oauth/authorize?client_id=<?= $facebook_app_id ?>&redirect_uri=http://www.example.com/facebook/oauth/&scope=user_about_me,publish_stream
sonra Token burada erişim elde:
$url = "https://graph.facebook.com/oauth/access_token?client_id=".$facebook_app_id."&redirect_uri=http://www.example.com/facebook/oauth/&client_secret=".$facebook_secret."&code=".$code;"
function get_string_between($string, $start, $end){
$string = " ".$string;
$ini = strpos($string,$start);
if ($ini == 0) return "";
$ini += strlen($start);
$len = strpos($string,$end,$ini) - $ini;
return substr($string,$ini,$len);
}
$access_token = get_string_between(file_get_contents($url), "access_token=", "&expires=");
sonra alıyorum kullanıcı bilgisi:
$facebook_user = file_get_contents('https://graph.facebook.com/me?access_token='.$access_token);
$facebook_id = json_decode($facebook_user)->id;
$first_name = json_decode($facebook_user)->first_name;
$last_name = json_decode($facebook_user)->last_name;
Bu (bence) oldukça çirkin ama ben kullanıcı giriş olduğunu onaylamak için herhangi bir oturum değişkenleri oluşturmak veya almak değil çünkü kullanıcı hala .. yapmadınız nasıl hiç .... .... çalışıyor Facebook'a ...
hangi kimlik kullanımını yapılır aldıktan sonra hala giriş anlamına gelir ....
first: is there a better way using php to do what i did above ? second: how do i set/ get session variable / cookies that ensure that the user doesnt have to click login
Yardımlarınız için teşekkürler