Login pelo facebook
Pessoal estou com sistema de login pelo facebook, porem estou com um erro. Apos clica em entrar pelo facebook e autorizar aplicativo, quando volta pro site aparece esse erro:
/applications/core/interface/imageproxy/imageproxy.php?img=http://i.imgur.com/2jLbHnZ.png&key=c2407dbbea94e72471af11ac7a5b5e8fa005e0bd22b972a43fd442ba4ed5ee64" width="1000" />
Codigo do erro:
public function facebook()
{
$facebook = $this->socialauthRepository->facebook();
$user = $facebook->getUser();
//try get the user profile
try {
$userProfile = $facebook->api('/me');
} catch(\FacebookApiException $e) {
$user = null;
}
if ($user) {
$needEdit = false;
if (empty($userProfile['email'])) {
$needEdit = true;
}
$username = \Str::slug($userProfile['name']);
$username = str_replace([' ','.', '-'], ['','', ''], $username);
$details = [
'fullname' => $userProfile['first_name']. ' '. $userProfile['last_name'],
'genre' => $userProfile['gender'],
'country' => '',
'email_address' => (isset($userProfile['email'])) ? $userProfile['email'] : '',
'password' => time(),
'username' => $username,
'auth' => 'facebook',
'authId' => $userProfile['id'],
'avatar' => ''
];
try{
ini_set('user_agent', 'Mozilla/5.0');
$avatar = json_decode(file_get_contents('https://graph.facebook.com/'.$userProfile['id'].'/picture?redirect=false&width=600&height=600'), true);
if ($avatar and isset($avatar['data']['url'])) {
$avatar = $avatar['data']['url'];
$details['avatar'] = $avatar;
}
} catch(\Exception $e){}
return $this->socialauthRepository->register($details);
} else {
$url = $facebook->getLoginUrl(['scope' => 'email']);
return \Redirect::to($url);
}
}Discussão (5)
Carregando comentários...