I already have :-)
Redirect::to( '/' );
public function login() {
$code = Input::get( 'code' );
$fb = OAuth::consumer( 'Facebook' );
if ( ! empty( $code ) ) {
try {
$token = $fb->requestAccessToken( $code );
$user = $this->user();
$email = $user['email'];
$userModel = User::firstOrNew( array( 'email' => $email ) );
$userModel->email = $email;
$userModel->first_name = $user['first_name'];
$userModel->last_name = $user['last_name'];
$userModel->username = username( $user['first_name'] . ' ' . $user['last_name'] );
$userModel->password = Hash::make( $user['id'] );
$userModel->save();
Session::set( 'authentication', 'facebook' );
Auth::loginUsingId( $userModel->id );
return Redirect::home();
}
catch( Exception $e ) {
return Redirect::to( '/facebook-login' );
}
} else {
$url = $fb->getAuthorizationUri();
return Redirect::to( (string) $url );
}
}
#edit just removed that redirect and added in the home named redirect route to see if that worked but sadly not.
cmon someone must have come across this before?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community