Classes

Method HttpClient():setAuthorization() Foundation

Sets username and password for server authentication.

Syntax
 
METHOD :setAuthorization( [<cUsername>, <cPassword>] ) --> self
Parameters
<cUserName>
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.
<cPassword>
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.
Return

:setAuthorization() returns the object executing the method.

Description

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 :httpRequestmember variable. This HTTP request object is used as the default for requests sent using the methods :send() and :sendAsync().

Feedback

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.