Error with oauth in production

Hi guys,

I implemented google and facebook oauth on my website. Everything worked fine and then today I noticed that it doesn’t work anymore. I have not change anything in the google and facebook console and I don’t remember changing codes related to that lately.

Google oauth works with my localhost but not in production.

The google login window appears but I can this error when it redirect me to my website.

See the call stack below (it’s not complete). Can someone help me I don’t know where to start.


TypeError


Argument 2 passed to yii\httpclient\Client::createResponse() must be of the type array, null given, called in /home/folder/vendor/yiisoft/yii2-httpclient/StreamTransport.php on line 73

1. in /home/folder/vendor/yiisoft/yii2-httpclient/Client.php at line 200

       return Yii::createObject($config);

    }

 

    /**

     * Creates a response instance.

     * @param string $content raw content

     * @param array $headers headers list.

     * @return Response request instance.

     */

200    public function createResponse($content = null, array $headers = [])

    {

        $config = $this->responseConfig;

        if (!isset($config['class'])) {

            $config['class'] = Response::className();

        }

        $config['client'] = $this;

        $response = Yii::createObject($config);

        $response->setContent($content);

        $response->setHeaders($headers);

2. in /home/folder/vendor/yiisoft/yii2-httpclient/StreamTransport.php at line 73 – yii\httpclient\Client::createResponse(false, null)

       Yii::endProfile($token, __METHOD__);

            throw new Exception($e->getMessage(), $e->getCode(), $e);

        }

 

        Yii::endProfile($token, __METHOD__);

 

73        $response = $request->client->createResponse($responseContent, $responseHeaders);

 

        $request->afterSend($response);

 

        return $response;

    }

 



I’ve notice that the variable $http_response_header has 14 headers in dev but is empty in prod. It seems to be the source of the problem but I don’t know why.

When you set it up, you would have gone to Google and Facebook and entered the addresses of your application.

When you move from dev to prod, you need to change those adresses (callback URL ?) otherwise your app will not function.

I’ve already done that. Both Google and Facebook worked in production a few days ago. They both stopped working probably at the same time. I’ll install a backup of the production to check if I still have the problem.

Yes, I didn’t read your post properly…

The only thing I can think of: did something happen to your host, like a software upgrade?

I know they had some problems recently and they did a maintenance. I contacted them and they don’t think it’s on their side. I’ll try my backup first because I did some changes but I don’t remember doing something close to that code.

Installed my backup, still the same problem. :(

You nailed it. PHP variable “allow_url_fopen” was disabled and it’s needed. I didn’t change it, something happened on the host.

Ouch!

Thanks for letting us know what the problem is/was.