- Feb 1, 2021
- 38
- 11
- 8
- Customer Identifier
- E074775
In order to authenticate the client in an HTTP request, the client's credentials must be specified in the request. To do this, the method :setAuthorization() of the HttpClient class can be used. This method automatically sets an "Authorization" HTTP header in the required format. If the server requires "Basic" authorization, :setAuthorization() automatically constructs an HTTP header of the following form:
Example:
Xbase++:
Header: "Authorization"
Value : "Basic <credentials>" // "<credentials>" is a Base64-encoded string with the client's credentials specified as "<user>:<password>".
Example:
Xbase++:
oClient := HttpClient():new( "http://httpbin.org/basic-auth/a/b" )
oClient:setAuthorization( "a", "b" )
Last edited by a moderator: