4D v13.4

HTTP AUTHENTICATE

Home

 
4D v13.4
HTTP AUTHENTICATE

HTTP AUTHENTICATE 


 

HTTP AUTHENTICATE ( name ; password {; authMethod} {; *} )  
Parameter Type   Description
name  Text in User name
password  Text in User password
authMethod  Longint in Authentication method: 0 or omitted=not specified, 1=BASIC, 2=DIGEST
Operator in If passed: authentication by proxy

The HTTP AUTHENTICATE command enables HTTP requests to servers requiring authentication of the client application. The BASIC and DIGEST methods are supported, as well as the presence of a proxy.

In the name and password parameters, you pass the id information required (user name and password). This information is encoded and added to the next HTTP request sent using the HTTP Request or HTTP Get command, so you need to call the HTTP AUTHENTICATE command before each HTTP request.

The optional authMethod parameter indicates the authentication method to use. You pass one of the following constants, found in the HTTP Client theme:

Constant Type Value Comment
HTTP Basic Longint 1 Use BASIC authentication method
HTTP Digest Longint 2 Use DIGEST authentication method

If you omit the authMethod parameter (or pass 0), you let the program choose the appropriate method to use. In this case, 4D sends an additional request in order to negotiate the authentication method.

If you pass the * parameter, this indicates that the authentication information is intended for an HTTP proxy. This setting must be implemented when there is a proxy requiring authentication between the client and the HTTP server. If the server itself is authenticated, a double authentication is necessary.

By default, authentication information is reset after each request, so you must use HTTP AUTHENTICATE before each HTTP Request or HTTP Get. However, it is possible to store this information temporarily using an option for the HTTP SET OPTION command. In this case, you no longer have to execute the HTTP AUTHENTICATE command before each request.

Example  

Examples of requests with authentication:

  // Authentication on HTTP server in DIGEST mode
 HTTP AUTHENTICATE("httpUser";"123";2)
  // Authentication on proxy in default mode
 HTTP AUTHENTICATE("ProxyUser";"456";*)
 $httpStatus:=HTTP Get(...)

 
PROPERTIES 

Product: 4D
Theme: HTTP Client
Number: 1161

 
INDEX

Alphabetical list of commands

 
HISTORY 

New
Created: 4D v13

 
SEE ALSO 

HTTP SET OPTION