auth
Summary
: Pass an array of HTTP authentication parameters to use with therequest. The array must contain the username in index [0], the password inindex [1], and you can optionally provide a built-in authentication type inindex [2]. Pass null to disable authentication for a request.
Types : - array - string - null
Default : None
Constant
: GuzzleHttp\RequestOptions::AUTH
The built-in authentication types are as follows:
basic
: Use basic HTTP authenticationin the Authorization header (the default setting used if none isspecified).
1. $client->request('GET', '/get', ['auth' => ['username', 'password']]);
digest : Use digest authentication(must be supported by the HTTP handler).
1. $client->request('GET', '/get', [
2. 'auth' => ['username', 'password', 'digest']
3. ]);
Note
This is currently only supported when using the cURL handler, butcreating a replacement that can be used with any HTTP handler isplanned.
ntlm : Use Microsoft NTLM authentication(must be supported by the HTTP handler).
1. $client->request('GET', '/get', [
2. 'auth' => ['username', 'password', 'ntlm']
3. ]);
Note
This is currently only supported when using the cURL handler.
