IAuthenticate::Authenticate method

Supplies authentication support to a URL moniker from a client application.

Syntax

HRESULT Authenticate(
  [out] HWND   *phwnd,
  [out] LPWSTR *pszUsername,
  [out] LPWSTR *pszPassword
);

Parameters

  • phwnd [out]
    The address of a client-provided HWND of the parent window for a default user interface. To prevent a user interface from displaying, the client must provide a user name and password in the other parameters, and this handle must be set to zero.

  • pszUsername [out]
    The address of a string value that contains the user name to use for authentication. If the client returns a value here, the client should also set phwnd to zero.

  • pszPassword [out]
    The address of a string value that contains the password to use for authentication. If the client returns a value here, the client should also set phwnd to zero.

Return value

Returns one of the following values.

Return code Description
S_OK

Authentication was successful.

E_ACCESSDENIED

Authentication failed.

E_INVALIDARG

One or more parameters are invalid.

 

Remarks

Applications that implement the IAuthenticate::Authenticate method must allocate the memory of the pszUsername and pszPassword buffers by using CoTaskMemAlloc. Applications that call the IAuthenticate::Authenticate method are responsible for freeing the memory with CoTaskMemFree.

The default user interface can handle any authentication schemes recognized by the Microsoft Win32 Internet API. Currently, the user name and password options handle only the Basic authentication scheme.

This method is related to the InternetErrorDlg function in the Win32 Internet API. For more information about the Win32 Internet API, see Introduction to the Microsoft Win32 Internet Functions.

Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows Server 2003

Product

Internet Explorer 4.0

DLL

Urlmon.dll

See also

IAuthenticate