plokko / firebase-php

Php integration of Firebase API (FCM Http v1, RealTime database)
16 stars 9 forks source link

OAuth middleware doesn't respect CURL settings or custom HTTP client #11

Closed Synergy-ek closed 3 years ago

Synergy-ek commented 5 years ago

In case of using CURL with proxy or IP binding, options doesn't pushed to OAuth2 middleware. If set, custom HTTP client should be posted to CredentialsLoader::makeHttpClient() at src/ServiceAccount.php, line 69

marianoarga commented 5 years ago

Looking forward to know about using this library with a proxy

plokko commented 4 years ago

The FCM Request class do support custom a GuzzleHttp client; as per documentation Guzzlehttp do support proxy options (note: request options can be set on client initialization, this is the required approach on this library)

//Custom http client 
$myClient = new Client([
    'proxy' => [
        'http'  => 'tcp://localhost:8125', // Use this proxy with "http"
        'https' => 'tcp://localhost:9124', // Use this proxy with "https",
        'no' => ['.mit.edu', 'foo.com']    // Don't use a proxy with these
    ]
]);
$request->setHttpClient($myClient);

The ServiceAccount should contain only the service account informations, connection options should be set on the calling class (in this example the FCM request that can authorize the request with a custom client)