Method HttpClient():setAuthorization() Foundation

Sets username and password for server authentication.

:setAuthorization( [<cUsername>, <cPassword>] ) --> self
A character string with the name of the user to be authenticated. This parameter is optional. If no user name is specified, the user name and password set in a previous call to :setAuthorization() are removed.
A character string with the user's password. This parameter may be omitted if no user name is passed in <cUsername>. Otherwise, <cPassword> is mandatory.

:setAuthorization() returns the object executing the method.


The method :setAuthorization() specifies the credentials for the user to be authenticated on the server for performing the next request. In order to reset the user credentials, the method :setAuthorization() must be called without parameters. Afterwards, no user will be authenticated for performing the next request.

The credentials specified in the parameters to :setAuthorization() are stored in the "Authorization" header element of the HTTP request object assigned to the :httpRequest member variable. This HTTP request object is used as the default for requests sent using the methods :send() and :sendAsync().


If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.