Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSL certificate problem #14

Closed
furey opened this issue May 29, 2017 · 0 comments
Closed

SSL certificate problem #14

furey opened this issue May 29, 2017 · 0 comments

Comments

@furey
Copy link

furey commented May 29, 2017

Hi! 👋

As always, another wonderful package from Spatie.

I thought I'd write up the following issue to help anyone who encounters it too.

While trying to get the package up and running on my local machine, on calling the put() method, the following exception was being thrown:

GuzzleHttp\Exception\RequestException with message 'cURL error 60: SSL certificate problem: Invalid certificate chain (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)'

To work around the exception, in DropboxServiceProvider, I simply instantiated and passed through my own GuzzleHttp\Client dependency with verify request option set to false:

<?php

namespace App\Providers;

use Storage;
use GuzzleHttp\Client as GuzzleClient;
use League\Flysystem\Filesystem;
use Spatie\Dropbox\Client as DropboxClient;
use Illuminate\Support\ServiceProvider;
use Spatie\FlysystemDropbox\DropboxAdapter;

class DropboxServiceProvider extends ServiceProvider
{
    /**
     * Perform post-registration booting of services.
     */
    public function boot()
    {
        Storage::extend('dropbox', function ($app, $config) {

            $accessToken = $config['accessToken'];

            $guzzleClient = new GuzzleClient([
                'headers' => [
                    'Authorization' => "Bearer {$accessToken}",
                ],
                'verify' => false,
            ]);

            $client = new DropboxClient($accessToken, $guzzleClient);

            return new Filesystem(new DropboxAdapter($client));

        });
    }

    /**
     * Register bindings in the container.
     */
    public function register() {}
}

Note: Guzzle's documentation mentions disabling certificate verification (setting the verify request option to false) is insecure, and thus, should probably be used with caution.

Hope this information helps someone else down the track.

Cheers!

@furey furey closed this as completed May 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant