---
title: "setNodeCredentials(_:password:)"
framework: opendirectory
role: symbol
role_heading: Instance Method
path: "opendirectory/odrecord/setnodecredentials(_:password:)"
---

# setNodeCredentials(_:password:)

Sets credentials for the record’s node.

## Declaration

```swift
func setNodeCredentials(_ inUsername: String!, password inPassword: String!) throws
```

## Parameters

- `inUsername`: The username to use to authenticate with the node.
- `inPassword`: The password to use to authenticate with the node.

## Discussion

Discussion If this function fails, the previous credentials for the node are used. note: In Swift, this method returns Void and is marked with the throws keyword to indicate that it throws an error in cases of failure. You call this method in a try expression and handle any errors in the catch clauses of a do statement, as described in Error Handling in The Swift Programming Language and About Imported Cocoa Error Parameters.

## See Also

### Managing Authentication

- [changePassword(_:toPassword:)](opendirectory/odrecord/changepassword(_:topassword:).md)
- [setNodeCredentialsWithRecordType(_:authenticationType:authenticationItems:continueItems:context:)](opendirectory/odrecord/setnodecredentialswithrecordtype(_:authenticationtype:authenticationitems:continueitems:context:).md)
- [verifyExtended(withAuthenticationType:authenticationItems:continueItems:context:)](opendirectory/odrecord/verifyextended(withauthenticationtype:authenticationitems:continueitems:context:).md)
- [verifyPassword(_:)](opendirectory/odrecord/verifypassword(_:).md)
