如何解决“Facebook 检测到 MyApp 未使用安全连接传输信息"的问题.Laravel 中的错误 [英] How to fix 'Facebook has detected MyApp isn't using a secure connection to transfer information.' error in Laravel
问题描述
我正在尝试使用 Laravel 和 socialite 包将我的应用程序连接到 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');
}
}
推荐答案
您可以创建测试应用"并使用测试应用替换您的 App ID 和 Secret.
You can do "Create Test App" and replace your App ID and Secret using the test app.
这篇关于如何解决“Facebook 检测到 MyApp 未使用安全连接传输信息"的问题.Laravel 中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!