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

# whenUserSignsIn

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

## Declaration

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

## Return Value

Return Value A Promise object that resolves to a CloudKit.UserIdentity dictionary when the user signs in, or rejects to a CKError object.

## Discussion

Discussion Use the whenUserSignsIn method to call a function when the user signs in. myContainer.whenUserSignsIn().then(function(userIdentity) {     // The user signed in });

## See Also

### Authenticating Users

- [setUpAuth](cloudkitjs/cloudkit.container/setupauth.md)
- [whenUserSignsOut](cloudkitjs/cloudkit.container/whenusersignsout.md)
