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]. Passnull
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).
- $client->request('GET', '/get', ['auth' => ['username', 'password']]);
- digest
- Use digest authentication(must be supported by the HTTP handler).
- $client->request('GET', '/get', [
- 'auth' => ['username', 'password', 'digest']
- ]);
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.aspx)(must be supported by the HTTP handler).
- $client->request('GET', '/get', [
- 'auth' => ['username', 'password', 'ntlm']
- ]);
Note
This is currently only supported when using the cURL handler.