hwi / HWIOAuthBundle

OAuth client integration for Symfony. Supports both OAuth1.0a and OAuth2.
MIT License
2.27k stars 797 forks source link

Debug Google OAuth behind AWS ELB #1405

Closed ozzmaster closed 3 years ago

ozzmaster commented 6 years ago

I have a working Google social login using this bundle.

It works really well, except when someone is NOT logged in to their GOOGLE account when they log in to our web site.

All the other social platforms work perfectly well as well.

I need help to debug where the process is breaking down. All I see is a single request tot he /connect-fail URL, as if the user did not add the application, or the process was cancelled by the user.

If the user logs in to a Google account BEFORE attempting to log on, it works just fine.

To frustrate and infuriate more ALL the above functionality works perfectly on our stage and master (backup of live) sites.

The only difference between the live and other environments is that live is hosted on AWS on ELB.

Here is our live site: https://www.markedplace.co.za/ Live backup: http://mepmaster.creativecloud.co.za/

Has anyone encountered this issue? Any help will be appreciated.

vittore commented 6 years ago

Yes. Modify web/app.php as above:

<?php

use Symfony\Component\HttpFoundation\Request;

/** @var \Composer\Autoload\ClassLoader $loader */
$loader = require __DIR__.'/../app/autoload.php';
include_once __DIR__.'/../var/bootstrap.php.cache';

$kernel = new AppKernel('prod', false);
$kernel->loadClassCache();
//$kernel = new AppCache($kernel);

// When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter
//Request::enableHttpMethodParameterOverride();
$request = Request::createFromGlobals();
Request::setTrustedProxies(
    // trust *all* requests
    array('127.0.0.1', $request->server->get('REMOTE_ADDR')),

    // if you're using ELB, otherwise use a constant from above
    Request::HEADER_X_FORWARDED_AWS_ELB
);
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
stloyd commented 3 years ago

Closing as outdated. If issue still occurs, please open new issue. Thank you.