Marios Paligiannis
Marios Paligiannis

Reputation: 107

504 Gateway Time-out nginx/1.15.8 Laravel Socialite

Two days now I try to spot an issue with this provider.

MY SETUP PHP VERSION: PHP 7.2.14 Zend Engine v3.2.0 Laravel Valet

Clearing cache php artisan cache:clear composer dump-autoload

FILE : .env

APP_URL=https://mywebsite.test/
SESSION_DRIVER=database
SESSION_LIFETIME=120

FACEBOOK_KEY=19242542********
FACEBOOK_SECRET=60c3c0a346******
FACEBOOK_REDIRECT_URI=ht

tps://mywebsite.test/login/facebook/callback/

CONFIGURING FACEBOOK CORECTLY

ROUTES

Route::get('login/facebook', 
'SocialLoginController@redirectToProvider');
Route::get('login/facebook/callback', 
'SocialLoginController@handleProviderCallback');

CONTROLLER

class SocialLoginController extends Controller
{

public function redirectToProvider()
{
    return Socialite::driver('facebook')->redirect();
}

/**
 * Obtain the user information from GitHub.
 *
 * @return \Illuminate\Http\Response
 */
public function handleProviderCallback(Request $request)
{
    $socialite = Socialite::with('facebook')->user();
    dd($socialite);
}
}

ISSUE When I login my account prompts me to continue as the user I am and that works. In the database a I see a record in session when I login. And I wait for 30"-60" and i get

504 Gateway Time-out nginx/1.15.8

Upvotes: 1

Views: 4748

Answers (2)

Abhinav Dobhal
Abhinav Dobhal

Reputation: 31

Solving this issue is easy: just open the file /usr/local/etc/nginx/valet/valet.conf and add the following lines to the block

location ~ .php$ { } :
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 600;
fastcgi_read_timeout 300;
fastcgi_buffers 8 128k;
fastcgi_buffer_size 256k;

Now all you have to do is to run on your valet restart terminal and everything should work fine.

Upvotes: 3

Mahmoud El-Mokhtar
Mahmoud El-Mokhtar

Reputation: 21

504 Gateway issues mean that the server timed out attempting to reach a remote server in that case probably facebook with socialite you will need to provide the redirect link that you use exactly as the one in your facebook app settings.

Upvotes: 0

Related Questions