4D v16.3

HTTP AUTHENTICATE

Home

 
4D v16.3
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 stored temporarily and reused for each request in the current process. However, it is possible to reset this information after each request using an option set by the HTTP SET OPTION command. In this case, you will have to execute the HTTP AUTHENTICATE command before each call to HTTP Request or HTTP Get.

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(...)



See also 

HTTP SET OPTION

 
PROPERTIES 

Product: 4D
Theme: HTTP Client
Number: 1161

This command can be run in preemptive processes

 
HISTORY 

Created: 4D v13

 
ARTICLE USAGE

4D Language Reference ( 4D v16)
4D Language Reference ( 4D v16.1)
4D Language Reference ( 4D v16.2)
4D Language Reference ( 4D v16.3)