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 Seems overly complicated and broken. #316

Closed
fusiondesign opened this issue Apr 24, 2018 · 3 comments
Closed

SSL Seems overly complicated and broken. #316

fusiondesign opened this issue Apr 24, 2018 · 3 comments

Comments

@fusiondesign
Copy link

fusiondesign commented Apr 24, 2018

The following is from a Laravel project. For the life of me, I cannot get SSL working unless I bypass this wrapper and use Guzzle directly by accessing getHttpClient() from the Gitlab\Client scope.

I've traced every line of code due to the lack of documentation and I've managed to hunt down every class that I need to make this possible. I cannot find where the error is inside the code, but there definitely seems to be some issue here.

<?php

use GuzzleHttp\Client as GuzzleClient;
use Http\Adapter\Guzzle6\Client as GuzzleAdapter;

use Http\Discovery\HttpClientDiscovery;
use Gitlab\HttpClient\Builder;
use Gitlab\Client;

$guzzle = GuzzleAdapter::createWithConfig([
	'base_uri' => 'https://my.gitlab.server/',
	'verify' => '/var/www/laravel/storage/certs/UserTrust.pem',
]);

$gitlab = Gitlab\Client::createWithHttpClient($guzzle)
		->authenticate(config('gitlab.token'), Gitlab\Client::AUTH_URL_TOKEN);

// Does work
dd($gitlab->getHttpClient()->get('https://my.gitlab.server/api/v4/projects'));

// Does not work. SSL error.
dd($gitlab->api('projects')->all());
@GrahamCampbell
Copy link
Member

Are you sure the 2nd example isn't just calling the wrong address?

Try this:

$guzzle = GuzzleAdapter::createWithConfig([
    'verify' => '/var/www/laravel/storage/certs/UserTrust.pem',
]);

$gitlab = Gitlab\Client::createWithHttpClient($guzzle)
    ->setUrl('https://my.gitlab.server/')
    ->authenticate(config('gitlab.token'), Gitlab\Client::AUTH_URL_TOKEN);

@fusiondesign
Copy link
Author

fusiondesign commented Apr 24, 2018

You are my hero!!!! Worked very first try XD

@fezfez
Copy link

fezfez commented May 6, 2018

@fusiondesign issue can be close ?

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

No branches or pull requests

4 participants