You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Http\Request;
use Socialite;
use App\Models\User;
class LoginController extends Controller {
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');
}
/**
* Redirect the user to the GitHub authentication page.
*
* @return \Illuminate\Http\Response
*/
public function redirectToLinkedin() {
$fields = [
"id", "firstName", "lastName",
"maidenName", "headline", "specialties",
"positions", "pictureUrl", "emailAddress"
];
return Socialite::with('linkedin')
->fields($fields)
->redirect();
}
/**
* Obtain the user information from GitHub.
*
* @return \Illuminate\Http\Response
*/
public function handleLinkedinCallback(Request $request) {
$linkedinUser = Socialite::driver('linkedin')->user();
// check if user exists in DB
$user = User::where('linkedin', '=', $linkedinUser['id'])->first();
// if user doesn't exit go to sign up page and populate form
if (!$user) {
$request->session()->put('linkedinUser', $linkedinUser->user);
return redirect()->route('signup');
}
// if user exists login him/her
Auth::loginUsingId($user->id);
return redirect('/');
}
}
but positions never return, I debugged the file
vendor/laravel/socialite/src/Two/LinkedInProvider.php
and var_dump $fields
and it didn't change the default fields
The text was updated successfully, but these errors were encountered:
This is the Code I am using
but positions never return, I debugged the file
vendor/laravel/socialite/src/Two/LinkedInProvider.php
and var_dump
$fields
and it didn't change the default fields
The text was updated successfully, but these errors were encountered: