<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "CloudKitJS",
  "identifier" : "/documentation/CloudKitJS/CloudKit.Container/discoverAllUserIdentities",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "CloudKit JS"
    ],
    "preciseIdentifier" : "instm/CloudKit.Container/discoverAllUserIdentities"
  },
  "title" : "discoverAllUserIdentities"
}
-->

# discoverAllUserIdentities

Fetches all user identities in the current user’s address book.

```
Promise<CloudKit.UserIdentitiesResponse, CloudKit.CKError> discoverAllUserIdentities();
```

## Return Value

A `Promise` object that resolves to a [`CloudKit.UserIdentitiesResponse`](/documentation/CloudKitJS/CloudKit.UserIdentitiesResponse) object, or rejects to a [`CKError`](/documentation/CloudKitJS/CloudKit/CKError) object.

## Discussion

Use this method to retrieve information about other users of the app. This method returns information about those users who meet the following criteria:

- The user must be in the current user’s address book.
- The user must have run the app.
- The user must have granted the permission to be discovered for this container.

To get the user identities, use the `users` property in the [`CloudKit.UserIdentitiesResponse`](/documentation/CloudKitJS/CloudKit.UserIdentitiesResponse) class, which contains an array of [`CloudKit.UserIdentity`](/documentation/CloudKitJS/CloudKit.UserIdentity) dictionaries.

```javascript
myContainer.discoverAllUserIdentities().then(function(response) {
    if(response.hasErrors) {
        // Insert error handling
        throw response.errors[0];
    } else {
        // Insert successfully discovered user code
        var users = response.users;
    }
  });
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)