客户端错误:`POST https:// graph.facebook.com / v3.0 / oauth / access_token`导致'400 Bad Request` [重复]

问题描述 投票:-2回答:1

客户端错误:POST https://graph.facebook.com/v3.0/oauth/access_token导致了400 Bad Request

响应:{“错误”:{“消息”:“\ u05d0 \ u05d9 \ u05df \ u05d0 \ u05e4 \ u05e9 \ u05e8 \ u05d5 \ u05ea \ u05dc \ u05d8 \ u05e2 \ u05d5 \ u05df \ u05d0 \ u05ea(截断... )

在laravel中安装socialite包

public function Callback(Request $request, $provider)
{
     try {
        $userSocial = Socialite::driver($provider)->stateless()->user();

    } 

    catch (Exception $e) {

        return redirect ('/');
    }
    if (!$request->has('code') || $request->has('denied')) {
        return redirect('/');
    }

    //$userSocial =   Socialite::driver($provider)->stateless()->user();
    $users       =   User::where(['email' => $userSocial->getEmail()])->first();
    if($users){
        Auth::login($users);
        return redirect('/home');
    }
    else
    {
        $user = User::create([
            'name'          => $userSocial->getName(),
            'email'         => $userSocial->getEmail(),
            'image'         => $userSocial->getAvatar(),
            'provider_id'   => $userSocial->getId(),
            'provider'      => $provider,
        ]);
        return redirect()->route('/home');
    }

任何帮助都非常感谢。

laravel facebook-graph-api
1个回答
0
投票

你可以使用这个php sdk(https://github.com/facebook/php-graph-sdk)。它支持php 5.4版。

© www.soinside.com 2019 - 2024. All rights reserved.