如何解决“Facebook 检测到 MyApp 未使用安全连接传输信息”的问题。Laravel 中的错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/57372648/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to fix 'Facebook has detected MyApp isn't using a secure connection to transfer information.' error in Laravel
提问by Mammadli Anar
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 ?
我正在尝试使用 Laravel 和 socialite 包将我的应用程序连接到 facebook 登录。但我不知道为什么 facebook 向我显示此错误。我搜索了互联网,但找不到任何内容。我该如何解决此错误?
I thought that if i make my connection with https it will work but after making https again error appears.
我认为如果我与 https 建立连接它会工作,但在再次连接 https 后会出现错误。
My code in laravel:
我在 Laravel 中的代码:
web.php
网页.php
Route::get('login/{provider}', 'SocialController@redirect');
Route::get('login/{provider}/callback','SocialController@Callback');
SocialController.php
社交控制器.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');
}
}
回答by Prakash Khadka
In case of angular : try to serve your app in secured socket layer truemode as Facebook is detecting insecure connection
在 angular 的情况下:尝试在安全套接字层真实模式下为您的应用程序提供服务,因为 Facebook 正在检测不安全的连接
Use the following command:
使用以下命令:
ng serve --ssl true