---
title: discoverAllUserIdentities
framework: CloudKit JS
role: symbol
role_heading: Instance Method
platforms: [cloudkit js 1.0+]
path: cloudkitjs/cloudkit.container/discoveralluseridentities
---

# discoverAllUserIdentities

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

## Declaration

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

## Return Value

Return Value A Promise object that resolves to a CloudKit.UserIdentitiesResponse object, or rejects to a CKError object.

## Discussion

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 class, which contains an array of CloudKit.UserIdentity dictionaries. 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;     }   });

## See Also

### Discovering Users

- [fetchCurrentUserIdentity](cloudkitjs/cloudkit.container/fetchcurrentuseridentity.md)
- [discoverUserIdentities](cloudkitjs/cloudkit.container/discoveruseridentities.md)
- [discoverUserIdentityWithEmailAddress](cloudkitjs/cloudkit.container/discoveruseridentitywithemailaddress.md)
- [discoverUserIdentityWithPhoneNumber](cloudkitjs/cloudkit.container/discoveruseridentitywithphonenumber.md)
- [discoverUserIdentityWithUserRecordName](cloudkitjs/cloudkit.container/discoveruseridentitywithuserrecordname.md)
