Laravel Socialite 410 Gone此资源在v1 API下不再可用

时间:2019-06-14 16:46:46

标签: php laravel laravel-5 linkedin-api

当我尝试通过linkedin api登录时。我收到这些错误

Client error: `GET https://api.linkedin.com/v1/people/~:(id,first-name,last-
name,formatted-name,email-address,headline,location,industry,public-profile-url,
picture-url,picture-urls::(original))` resulted in a `410 Gone`
response: { "errorCode": 0, "message": "This resource is no longer available under v1
APIs", "requestId": "56NEB1WQC2", "s (truncated...)
 */
public function redirectToProvider()
{
    return Socialite::driver('linkedin')->redirect();
}

/**
 * Obtain the user information from GitHub.
 *
 * @return \Illuminate\Http\Response
 */
public function handleProviderCallback()
{
    $userSocial = Socialite::driver('linkedin')->user();


    //check if user exists and log user in

    $user = User::where('email', $userSocial->email)->first();
    if($user){
        if(Auth::loginUsingId($user->id)){
           return redirect()->route('home');
        }
    }

 //else sign the user up
 $userSignup = User::create([
        'name' => $userSocial->name,
        'email' => $userSocial->email,
        'password' => bcrypt('1234'),
        'avatar'=> $userSocial->avatar,
        'linkedIn_profile'=> $userSocial->user['link'],
        'role_id' => '10'
    ]);


    //finally log the user in
    if($userSignup){
        if(Auth::loginUsingId($userSignup->id)){
            return redirect()->route('home');
        }
    }

}

}

1 个答案:

答案 0 :(得分:0)

Socialite issue github repo

  

问题已解决   
  我已使用以下命令更新了我的socialite / src / Two / LinkedInProvider.php文件:-

\

}