Skip to content
This repository has been archived by the owner on Feb 12, 2019. It is now read-only.

Argument 1 passed to GuzzleHttp\Client::__construct() must be of the type array, null given, #10

Closed
Relaxe111 opened this issue Jul 19, 2018 · 13 comments

Comments

@Relaxe111
Copy link

Hi, then i try to protect a resource with midleware 'auth' i get this ugly error:
Argument 1 passed to GuzzleHttp\Client::__construct() must be of the type array, null given, called in C:\wamp\www\advoca\vendor\furdarius\oidconnect-laravel\src\ServiceProvider.php on line 68
I have folowed all intructions. I use laravel 5.6 any ideas?

@Relaxe111
Copy link
Author

found problem it happens because opidconnect.php shall be located in app/config folder of application not in furdarius folder.

@dzr82
Copy link

dzr82 commented Jul 19, 2018

Good one. Might be very helpfull put It into readme.

@Relaxe111
Copy link
Author

i can't understand how to redirect user to provider for authentication. I have client id aand client secret.

@Relaxe111
Copy link
Author

do you have any idea?

@dzr82
Copy link

dzr82 commented Jul 20, 2018

There is a route file in the opidconnect... It's the /protect who does the magic. After all tests done, you can change it in the laravel route file (routes.php or web.php depending on the version). The opidconnect been set Whit your provider address, secret, your client id and the URI to return, it should give back to you the $request var fullfiled in the token Class (can't remember right now the class name).

@Relaxe111
Copy link
Author

yes Thankyou. ) I found that. Now I need to specify somewhere atributes and state. I try to debug where is fylled default ones but can't find. Do yoyu now how to do that?

@dzr82
Copy link

dzr82 commented Jul 20, 2018

If you're talking about attributes from the authenticated user... It's up to the provider... You should see it whith a dd($request) in the handle() function in tokenmiddleware.php. As far as I know, it's where the token from provider is parsed to all the attributes permitted from provider.

@Relaxe111
Copy link
Author

no i mean scopes, i found out how to do: in AuthController::redirect method from furdarius/oidconnect/src/http/ i changed $redicrectREsponse to:

 public function redirect()
    {
        /** @var \Symfony\Component\HttpFoundation\RedirectResponse $redirectResponse */
      
$redirectResponse = \Socialite::driver('myoidc')
                                ->with(['state'=>'test12345',
                                        'acr_values'=>'urn:signicat:oidc:method:nbid'])
                                ->setScopes(['phone','profile','signicat.national_id','email','openid'])
                                ->stateless()
                                ->redirect();

        return $redirectResponse;
    }

and i got what i need but in not correct order and i get :

invalid_request
The provided redirect URI is not configured for this client.
i should have in this order :

https://preprod.signicat.com/oidc/authorize?response_type=code&scope=phone+profile+signicat.national_id+email+openid&client_id=my.client.id&redirect_uri=http%3A%2F%2Fadvoca.avans%2Fauth%2Fcallback&acr_values=urn%3Asignicat%3Aoidc%3Amethod%3Anbid&signicat_profile=&state=test12345

but i get :

https://preprod.signicat.com/oidc/authorize?client_id=my.client.id&redirect_uri=%2Fauth%2Fcallback&scope=phone+profile+signicat.national_id+email+openid&response_type=code&state=test12345&acr_values=urn%3Asignicat%3Aoidc%3Amethod%3Anbid

It is possible to change order of uri elements?

@dzr82
Copy link

dzr82 commented Jul 20, 2018

I guess the order is up to provider too, since all the information is coded in token, and it's a middleware that parse it.

@Relaxe111
Copy link
Author

request uri is build by Socialite laravel and I found out that is abstract createUrl method which build uri and as parameters its get an array of provided elements. I will try to manipulate with order of elements in that array and will see what I will get. Will come with more details after then I will test this.

@dzr82
Copy link

dzr82 commented Jul 20, 2018

Great! I couldn't adapt this to my project. We end up using socialite custom drives to make it through.

@Relaxe111
Copy link
Author

Order does not matter! problem was that I not specified one parameter namely signicat.national_id. after adding this additional parameter everything worked). See what next errors will get).

@Relaxe111
Copy link
Author

Actually this package is build smart problem is that's uses a loooot of external libraries and classes where is wery easy to loose your self. But with patience and XDebug is possible to find out how its works

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants