---
title: "ODNodeSetCredentials(_:_:_:_:_:)"
framework: opendirectory
role: symbol
role_heading: Function
path: "opendirectory/odnodesetcredentials(_:_:_:_:_:)"
---

# ODNodeSetCredentials(_:_:_:_:_:)

Sets credentials for interacting with a node.

## Declaration

```swift
func ODNodeSetCredentials(_ node: ODNodeRef!, _ recordType: String!, _ recordName: CFString!, _ password: CFString!, _ error: UnsafeMutablePointer<Unmanaged<CFError>?>!) -> Bool
```

## Parameters

- `node`: The node.
- `recordType`: The record type that uses the credentials. Can be NULL. The default value is kODRecordTypeUsers.
- `recordName`: The username to use to authenticate with the node.
- `password`: The password to use to authenticate with the node.
- `error`: An error reference for error details. Can be NULL.

## Return Value

Return Value true if the credentials are successfully set; otherwise, false.

## Discussion

Discussion If this function fails, the previous credentials for the node are used. This function sets credentials for all references to the node. If you only want to set credentials for a single record referencing the node, use ODRecordSetNodeCredentials(_:_:_:_:) instead.

## See Also

### Related Documentation

- [Record Types](opendirectory/record-types.md)

### Working with Nodes

- [ODNodeCopyDetails(_:_:_:)](opendirectory/odnodecopydetails(_:_:_:).md)
- [ODNodeCopyRecord(_:_:_:_:_:)](opendirectory/odnodecopyrecord(_:_:_:_:_:).md)
- [ODNodeCopySubnodeNames(_:_:)](opendirectory/odnodecopysubnodenames(_:_:).md)
- [ODNodeCopySupportedAttributes(_:_:_:)](opendirectory/odnodecopysupportedattributes(_:_:_:).md)
- [ODNodeCopySupportedRecordTypes(_:_:)](opendirectory/odnodecopysupportedrecordtypes(_:_:).md)
- [ODNodeCopyUnreachableSubnodeNames(_:_:)](opendirectory/odnodecopyunreachablesubnodenames(_:_:).md)
- [ODNodeCreateCopy(_:_:_:)](opendirectory/odnodecreatecopy(_:_:_:).md)
- [ODNodeCreateRecord(_:_:_:_:_:)](opendirectory/odnodecreaterecord(_:_:_:_:_:).md)
- [ODNodeCreateWithName(_:_:_:_:)](opendirectory/odnodecreatewithname(_:_:_:_:).md)
- [ODNodeCreateWithNodeType(_:_:_:_:)](opendirectory/odnodecreatewithnodetype(_:_:_:_:).md)
- [ODNodeCustomCall(_:_:_:_:)](opendirectory/odnodecustomcall(_:_:_:_:).md)
- [ODNodeGetName(_:)](opendirectory/odnodegetname(_:).md)
- [ODNodeGetTypeID()](opendirectory/odnodegettypeid().md)
- [ODNodeSetCredentialsExtended(_:_:_:_:_:_:_:)](opendirectory/odnodesetcredentialsextended(_:_:_:_:_:_:_:).md)
