> For the complete documentation index, see [llms.txt](https://docs.dfinery.ai/developer-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.dfinery.ai/developer-guide/en/undefined-1/ios/identity.md).

# Set user identification information

How to set user identification information using DFINERY SDK. [SDK integration](https://docs.dfinery.ai/developer-guide/en/undefined-1/ios/integration) must be done first.

### Set up <a href="#undefined" id="undefined"></a>

User identification information can be set using `DfineryProperties.setIdentity`and `DfineryProperties.setIdentities` methods. User identification information is defined in `DFIdentity`, and only defined values ​​can be used.

{% hint style="warning" %}
`EXTERNAL_ID`In this case, it is recommended to use a fixed value as it is used as an important value to distinguish users among user identification information. Please be careful not to include personal information. If personal information such as email address or phone number is included, it is recommended to encrypt it.
{% endhint %}

### User identification information

| Name                       | Detail                  |
| -------------------------- | ----------------------- |
| `DFIdentity.EXTERNAL_ID`   | User ID                 |
| `DFIdentity.EMAIL`         | User's email            |
| `DFIdentity.PHONE_NO`      | User's phone number     |
| `DFIdentity.KAKAO_USER_ID` | User's Kakao account ID |
| `DFIdentity.LINE_USER_ID`  | User's Line account ID  |

### Set by item

```swift
func setIdentity(key: String, value: String?)
```

* `key`: User identification information key (using the DFIdentity constant)
* `value`: User identification information value

{% tabs %}
{% tab title="Swift" %}

```swift
Dfinery.shared().setIdentity(key: DFIdentity.EMAIL, value: "jimmy.kang@igaworks.com")
```

{% endtab %}

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

```objective-c
[[Dfinery shared] setIdentityForKey:DFIdentity.EMAIL value:@"jimmy.kang@igaworks.com"];
```

{% endtab %}
{% endtabs %}

### Set multiple items at once

```swift
func set(identities: [String: String])
```

* `identities`: You must enter the type and value of user identification information in the form of `Dictionary<String, String>`. The `value` cannot be `nil`.

{% tabs %}
{% tab title="Swift" %}

```swift
Dfinery.shared().set(identities: [            
    DFIdentity.PHONE_NO: "821012345678",
    DFIdentity.EXTERNAL_ID: "external_id"
])
```

{% endtab %}

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

```objective-c
[[Dfinery shared] setIdentityWithDict:@{
    DFIdentity.PHONE_NO: @"821012345678",
    DFIdentity.EXTERNAL_ID: @"external_id"
}];
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
For phone numbers, please enter them in the following format: ex) 821012345678, 82212345678
{% endhint %}

## Reset user identification information

{% hint style="info" %}
For iOS, user identification information remains even after deleting and reinstalling the app.
{% endhint %}

You can call the `resetIdentity()` method to remove and initialize any previously stored user identification information.

{% hint style="danger" %}
Please be careful when making calls, as initializing user identification information will interrupt any ongoing event flow and disconnect the terminal from the user.

If you still call, please call the event you want to reflect before calling the API to reflect the collected events.
{% endhint %}

{% tabs %}
{% tab title="Swift" %}

```swift
Dfinery.shared().resetIdentity()
```

{% endtab %}

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

```objective-c
[[Dfinery shared] resetIdentity];
```

{% endtab %}
{% endtabs %}

### Learn more <a href="#undefined-8" id="undefined-8"></a>

If you need more details on user federation, see [User Federation Scenarios](https://docs.dfinery.ai/developer-guide/common/identity-scenario) in Advanced Use Cases.
