> For the complete documentation index, see [llms.txt](https://bayun.gitbook.io/bayuncoresdk-ios/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bayun.gitbook.io/bayuncoresdk-ios/4-authentication/5.6-change-password.md).

# 5.6 Change Password

To change password for a user on Bayun, use `changePassword:newPassword:success:failure:` method.

The method takes the following parameters :

* **currentPassword** : Current Password.
  * dataType : `NSString`
* **newPassword** : New Password.
  * dataType : `NSString`
* **success** : Success block to be executed after password is successfully changed.
* **failure** : Failure block to be executed if change password fails, returns `BayunError`.

{% tabs %}
{% tab title="Objective-C" %}

```objectivec
[[BayunCore sharedInstance] changePassword:@"currentPassword" newPassword:@"newPassword"       success:^{
      NSLog("Password changed successfully.");    
 } failure:^(BayunError error) {
      NSLog("Change password failed.");
}];
```

{% endtab %}

{% tab title="Swift" %}

```swift
BayunCore.sharedInstance().changePassword("currentPassword", newPassword: "newPassword", success: {
   NSLog("Password changed successfully.")         
}, failure:  { (bayunErrorCode) in
   NSLog("Change password failed.")
})
```

{% endtab %}
{% endtabs %}
