---
title: "CFHTTPMessageApplyCredentialDictionary(_:_:_:_:)"
framework: cfnetwork
role: symbol
role_heading: Function
path: "cfnetwork/cfhttpmessageapplycredentialdictionary(_:_:_:_:)"
---

# CFHTTPMessageApplyCredentialDictionary(_:_:_:_:)

Use a dictionary containing authentication credentials to perform the authentication method specified by a CFHTTPAuthentication object.

## Declaration

```swift
func CFHTTPMessageApplyCredentialDictionary(_ request: CFHTTPMessage, _ auth: CFHTTPAuthentication, _ dict: CFDictionary, _ error: UnsafeMutablePointer<CFStreamError>?) -> Bool
```

## Parameters

- `request`: The request for which the authentication method is to be performed.
- `auth`: A CFHTTPAuthentication object specifying the authentication method to perform.
- `dict`: A dictionary containing authentication credentials to be applied to the request. For information on the keys in this dictionary, see doc://com.apple.cfnetwork/documentation/CFNetwork/CFHTTPAuthentication.
- `error`: If an error occurs, upon return contains a doc://com.apple.documentation/documentation/CoreFoundation/CFStreamError object that describes the error and the error’s domain. Pass NULL if you don’t want to receive error information.

## Return Value

Return Value TRUE if the authentication was successful, otherwise, FALSE.

## Discussion

Discussion This function performs the authentication method specified by auth on behalf of the request specified by request using the credentials contained in the dictionary specified by dict. The dictionary must contain values for the kCFHTTPAuthenticationUsername and kCFHTTPAuthenticationPassword keys. If CFHTTPAuthenticationRequiresAccountDomain(_:) returns TRUE for auth, the dictionary must also contain a value for the kCFHTTPAuthenticationAccountDomain key. Special Considerations This function is thread safe as long as another thread does not alter the same CFHTTPAuthentication object at the same time.

## See Also

### HTTP Messages

- [CFHTTPMessage](cfnetwork/cfhttpmessage.md)
- [CFHTTPMessageAddAuthentication(_:_:_:_:_:_:)](cfnetwork/cfhttpmessageaddauthentication(_:_:_:_:_:_:).md)
- [CFHTTPMessageAppendBytes(_:_:_:)](cfnetwork/cfhttpmessageappendbytes(_:_:_:).md)
- [CFHTTPMessageApplyCredentials(_:_:_:_:_:)](cfnetwork/cfhttpmessageapplycredentials(_:_:_:_:_:).md)
- [CFHTTPMessageCopyAllHeaderFields(_:)](cfnetwork/cfhttpmessagecopyallheaderfields(_:).md)
- [CFHTTPMessageCopyBody(_:)](cfnetwork/cfhttpmessagecopybody(_:).md)
- [CFHTTPMessageCopyHeaderFieldValue(_:_:)](cfnetwork/cfhttpmessagecopyheaderfieldvalue(_:_:).md)
- [CFHTTPMessageCopyRequestMethod(_:)](cfnetwork/cfhttpmessagecopyrequestmethod(_:).md)
- [CFHTTPMessageCopyRequestURL(_:)](cfnetwork/cfhttpmessagecopyrequesturl(_:).md)
- [CFHTTPMessageCopyResponseStatusLine(_:)](cfnetwork/cfhttpmessagecopyresponsestatusline(_:).md)
- [CFHTTPMessageCopySerializedMessage(_:)](cfnetwork/cfhttpmessagecopyserializedmessage(_:).md)
- [CFHTTPMessageCopyVersion(_:)](cfnetwork/cfhttpmessagecopyversion(_:).md)
- [CFHTTPMessageCreateCopy(_:_:)](cfnetwork/cfhttpmessagecreatecopy(_:_:).md)
- [CFHTTPMessageCreateEmpty(_:_:)](cfnetwork/cfhttpmessagecreateempty(_:_:).md)
- [CFHTTPMessageCreateRequest(_:_:_:_:)](cfnetwork/cfhttpmessagecreaterequest(_:_:_:_:).md)
