wwHTTP::AddBasicAuthenticationHeader

Adds a Basic Authentication Authorize header with properly encoded scheme and encoded username and password to the Http headers of the request.

Immediately sends this username and password with the request, not waiting for a server challenge.

o.AddBasicAuthenticationHeader(lcUsername, lcPassword)

Parameters

lcUsername
The user name to log in on the server with Basic Auth.

lcPassword
The password for the server

Remarks

Unlike the cUsername and cPassword properties which can also be used for Authentication, this mechanism explicitly sets the header which is sent on the immediate request. The two properties require the server to first respond with an Auth Challenge, which then causes wwHttp to resend the request with the auth data. This is more secure and also results in credentials getting cached, whereas explicit sending does not.

As a general rule, if the server supports challenging, use cUsername and cPassword especially in HTML applications. If you're calling a REST Service or other service that requires Basic Auth on every request, explicitly sending the header is the better and more efficient choice.


See also:

West Wind Web Connection | wwHttp::cUsername

© West Wind Technologies, 1996-2024 • Updated: 02/25/24
Comment or report problem with topic