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 Authorization or Proxy-Authorization header field


An AuthorizationField object contains credentials in a request message in response to a challenge from a server in an AuthenticateField. The credentials are in the form of an AuthInfo object. For a description of these fields, see RFC 7235 section 4.2 and section 4.4.

MATLAB® automatically creates this field when:

  • HTTPOptions.Authenticate property is true (default) in a request message.

  • You have specified appropriate credentials in the HTTPOptions.Credentials property.

  • MATLAB supports the authentication scheme requested by the server.

You create this field explicitly when you disable automatic authentication or implement an unsupported authentication protocol. If you create this field explicitly, then set the Value property to a valid authorization string or an AuthInfo object.

To see the AuthorizationField that was sent to the server for automatic authentication, examine the completed request or history arguments returned by the RequestMessage.send method.



obj =,value) creates an authorization header field with the Name property set to name and the Value property set to value. Create this field if you disabled automatic authentication or to implement an unsupported authentication protocol.


expand all

Header field name, specified as 'Authorization' or 'Proxy-Authorization'.

Authorization, specified as a valid authorization string or a object.



Value of AuthorizationField as vector of AuthInfo objects.

There is only one AuthInfo object in an AuthorizationField. If you pass in a vector of AuthorizationField objects, convert returns an equal-size vector of AuthInfo objects. The parameters in AuthInfo correspond to parameters of the credentials in the AuthorizationField. This set of parameters varies depending on the AuthInfo.Scheme property, which is the first token in the field.




collapse all

creds = Credentials('Username','MyName','Password','MyPassword');
options = HTTPOptions('Credentials', creds);
[response, request] = RequestMessage().send('',options);
authorizationField = request.getFields('Authorization');
authInfo = authorizationField.convert;
Was this topic helpful?