This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page. class


HTTP WWW-Authenticate or Proxy-Authenticate header field


An AuthenticateField contains one or more challenges from a server asking for authentication information. A server or proxy creates an AuthenticateField in a response message.

When you send a request message to a server or through a proxy that requires authentication, MATLAB® automatically tries to authenticate to the server or proxy when:

  • HTTPOptions.Authenticate property is true (default)

  • HTTPOptions.Credentials property contains the necessary names and passwords.

If authentication is successful, the response message returns an OK status and does not contain an authentication field.

A response message returns an authentication field if you disable authentication or if authentication failed. In that case, the status code of the response message is either 401 (Unauthorized) or 407 (ProxyAuthenticationRequired). Examine the AuthInfo object and respond by adding the appropriate AuthorizationField to the request message containing your credentials. Or resend the request by setting the correct Credentials property in HTTPOptions.

If the server or proxy requires an authentication scheme that MATLAB does not support, you must implement the authentication protocol yourself. Create a request message with the appropriate credentials and other information.


obj =,value) creates an authentication header field with the Name property set to name and the Value property set to value. A server creates this field in a response message. Use this constructor for test purposes.


expand all

Header field name, specified as 'WWW-Authenticate' or 'Proxy-Authenticate'.

A comma-separated list of challenges, specified as a vector of objects or a string in the format defined by RFC 7235 and RFC 2617. Use the AuthenticateField.convert method to parse this field.



Value of AuthenticateField as vector of AuthInfo objects, one for each challenge in the header field, in the order they appear in AuthenticateField.

The Realm property in each AuthInfo object contains a string to determine the context of the challenge. For example, to create a user name and password prompt for credentials, display the Realm property text to the user.

If the challenge does not contain a realm attribute, the Realm property is an empty value.

Introduced in R2016b

Was this topic helpful?