如何修复"Facebook已检测到MyApp没有使用安全连接来传输信息". Laravel中的错误 [英] How to fix 'Facebook has detected MyApp isn't using a secure connection to transfer information.' error in Laravel
问题描述
我正在尝试使用Laravel和社交名流软件包将我的应用连接到Facebook登录.但是我不知道为什么Facebook向我显示此错误.我搜索了互联网,但找不到任何东西.如何解决此错误?
I am trying to connect my app to facebook login with Laravel and socialite package.But i don't know why facebook show me this error. I searched internet but i couldn't find anything .How can i fix this error ?
我认为,如果我与https建立连接,则可以正常使用,但在再次创建https后会出现错误.
I thought that if i make my connection with https it will work but after making https again error appears.
我在laravel中的代码:
My code in laravel:
web.php
Route::get('login/{provider}', 'SocialController@redirect');
Route::get('login/{provider}/callback','SocialController@Callback');
SocialController.php
SocialController.php
public function redirect($provider)
{
return Socialite::driver($provider)->redirect();
}
public function Callback($provider){
$userSocial = Socialite::driver($provider)->stateless()->user();
$users = User::where(['email' => $userSocial->getEmail()])->first();
if($users){
Auth::login($users);
return redirect('/');
}else{$user = User::create([
'username' => $userSocial->getName(),
'email' => $userSocial->getEmail(),
'provider_id' => $userSocial->getId(),
'provider' => $provider,
]);
return redirect()->route('home');
}
}
推荐答案
简单的答案是-Facebook将向提供的redirect_uri
发送敏感数据,因此通过强制您使用有效的SSL来确保此连接是私有的.
The simple answer is - Facebook will send sensitive data to provided redirect_uri
, so it is ensuring this connection is private, by forcing you to use valid SSL.
只要您没有使用适当的证书设置有效域,Facebook都不会允许您使用生产API.
As long as you do not setup a valid domain with proper certificate, Facebook won't let you use production API.
这篇关于如何修复"Facebook已检测到MyApp没有使用安全连接来传输信息". Laravel中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!