Home>
I am a beginner.
Facebook login is implemented in laravel6/socialite.
When I access facebook, I get the following error.
Unable to access this site (on browser)
Invalid request (Unsupported SSL request) (Terminal)
Closed without sending a request;it was probably just an unused speculative preconnection
I tried the following site.
https://stackoverflow.com/questions/57617864/how-to-fix-invalid-request-unsupported-ssl-request
https://qiita.com/kent_ear/items/6fcc477392aaede175f4
<? php
namespace App \ Http \ Controllers \ Auth;
use App \ Http \ Controllers \ Controller;
use Illuminate \ Foundation \ Auth \ AuthenticatesUsers;
use Laravel \ Socialite \ Facades \ Socialite;
use App \ User;
use Auth;
class LoginController extends Controller
{
/ *
| ------------------------------------------------- -------------------------
| Login Controller
| ------------------------------------------------- -------------------------
|
| This controller handles authenticating users for the application and
| redirecting them to your home screen. The controller uses a trait
| to conveniently provide its functionality to your applications.
|
* /
use AuthenticatesUsers;
/ **
* Where to redirect users after login.
*
* @var string
* /
protected $redirectTo = '/ home';
/ **
* Create a new controller instance.
*
* @return void
* /
public function __construct ()
{
$this->middleware ('guest')->except ('logout');
}
// Link from login button
public function FacebookLogin ()
{
return Socialite :: driver ('facebook')->redirect ();
}
// Callback processing
public function FacebookCallback ()
{
$facebook_user = Socialite :: driver ('facebook')->user ();
// Check registration by email
$user = User :: where (['email' =>$facebook_user->getEmail ()])->first ();
// Branch with or without registration (email)
if ($user) {
// If i register, just log in (from the second time)
Auth :: login ($user);
return redirect ('/ home');
} else {
// If not registered (first time)
$newuser = New User;
$newuser->name = $facebook_user->getName ();
$newuser->email = $facebook_user->getEmail ();
$newuser->save ();
// login as it is
Auth :: login ($newuser);
return redirect ('/ home');
}
}
}
Route :: get ('/ login/facebook', 'Auth \ LoginController @ FacebookLogin');
Route :: get ('/ login/facebook/callback', 'Auth \ LoginController @ FacebookCallback');
FACEBOOK_API_ID = 25985 *
FACEBOOK_API_SECRET = 94a9da *
FACEBOOK_CALLBACKURL = https: //127.0.0.1: 8000/login/facebook/callback
I couldn't find where the mistake was.
I want you to lend someone wisdom.
Thank you.
laravel6.18
php7.4.2
-
Answer # 1
Related articles
- aws cognito login with facebook account doesn't work!
- i want to send a request to an app with a login screen using phpstorm's http client
- vuejs - line login api does not return post request
- java - i get an error when i make an app that uses facebook login as per the tutorial
- laravel6 displays "app id is invalid" in facebook authentication
- Method for vue-resource request to implement http login interception or route interception
- vue axios login request interceptor
- SpringBoot + SpringSecurity handle Ajax login request (recommended)
Trends
Really an error on Facebook?
Isn't this an error for 127.0.0.1 when you get redirected back from Facebook?
Double check your browser's address bar.
Https error for 127.0.0.1
Modify the redirected URL to http and continue working