Невозможно войти в систему с помощью Facebook с помощью laravel socialite

#facebook #laravel-8 #facebook-login #laravel-socialite

Вопрос:

Привет, я пытаюсь интегрировать вход в facebook в приложение laravel, в котором я использую REST API для предоставления данных моему интерфейсу NextJS routes/web.php

маршруты для авторизации в socialite

config/services.php

 'facebook' => [
    'client_id' => env('FACEBOOK_CLIENT_ID'),
    'client_secret' => env('FACEBOOK_CLIENT_SECRET'),
    'redirect' => env('FACEBOOK_CALLBACK_URL'),
],
 

HTTP/Controllers/SocialAuithController.php

 public function redirectTo($socialite)
{
    return Socialite::driver($socialite)->redirect();
}

 public function handleSocialiteCallback($socialite)
{
    try {
        $user = Socialite::driver($socialite)->stateless()->user();
    } catch (Exception $e) {
        return abort(401, 'Invalid login.');
    }

    // check if they're an existing user
    $localUser = User::where('email', $user->email)->first();

    if (is_null($localUser)) {
        $localUser = new User;
    }

    // Update user
    if ($socialite === 'google') {
        $localUser->google_id       = $user->id;
        $localUser->first_name      = $user->user['given_name'];
        $localUser->last_name       = $user->user['family_name'];
    } else if ($socialite === 'facebook') {
        $localUser->facebook_id = $user->id;
    } else if ($socialite === 'linkedin') {
        $localUser->linkedin_id = $user->id;
        $localUser->name = $user->name;
    }

    $localUser->email           = $user->email;
    $localUser->name            = $user->name;
    $localUser->external_account_avatar          = $user->avatar;
    $localUser->save();

    $token = auth()->login($localUser, true);

    Token::createFromRequest(request(), $token);

    return redirect()->intended(config('app.ui_base_url').'?token='.$this->tokenData($token)['access_token']);
}
 

Он продолжает выдавать мне эту ошибку

Ошибка клиента: POST https://graph.facebook.com/v3.3/oauth/access_token выдан 400 Bad Request ответ: {«ошибка»: {«сообщение»: «Отсутствует код авторизации», «тип»:»OAuthException», «код»: 1, «fbtrace_id»: «AnIq6tA8Y5wS-HXnYWiHvOh» (усеченный …)

Это изображение настроек входа в Facebook моего приложения Это изображение настроек входа в Facebook моего приложения

When i try to login it keeps giving me this

when i try to login it keeps giving me this

and after that it redirects to my app to this link
https://api.exampleapp.com/auth/facebook/callback?error_code=1349191amp;error_message=Login Failed: You can’t use Facebook to log into this app or website because there’s an issue with its implementation of Facebook Login.#_=_

Can someone tell me where might i went wrong? I believe i followed all documentation that laravel provided with regard to socialite but can’t seem to work on this. Is the issue on the Laravel API ?

I’ve also appealed to facebook because i think this is a facebook app issue but they provided me with this email

We have reviewed your app and it is currently in violation of Facebook_ Developer Policy 6.1. Please refer to attached screenshot for your reference.

«Verify that you have integrated Login correctly. Your app shouldn’t crash or hang during the testing process.»

During Login, your app is crashing or hanging excessively, creating a broken experience for people trying to use your app. To make sure this flow runs smoothly, check that you’ve integrated Facebook Login correctly. We recommend that you test Login on all integrations. If you have not already done so, please: