<!--
{
  "availability" : [

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

# whenUserSignsIn

Returns an object representing a deferred or asynchronous operation that resolves when the user signs in.

```
Promise<CloudKit.UserIdentity, CloudKit.CKError> whenUserSignsIn();
```

## Return Value

A `Promise` object that resolves to a [`CloudKit.UserIdentity`](/documentation/CloudKitJS/CloudKit.UserIdentity) dictionary when the user signs in, or rejects to a [`CKError`](/documentation/CloudKitJS/CloudKit/CKError) object.

## Discussion

Use the [`whenUserSignsIn`](/documentation/CloudKitJS/CloudKit.Container/whenUserSignsIn) method to call a function when the user signs in.

```javascript
myContainer.whenUserSignsIn().then(function(userIdentity) {
    // The user signed in
});
```

---

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)