Support the ongoing development of Laravel.io →
Requests
Last updated 2 years ago.
0

Can you show your redirection code.

Last updated 2 years ago.
0

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.

Last updated 2 years ago.
0

anyone???

Last updated 2 years ago.
0

cmon someone must have come across this before?

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.