# Set User Identification Information

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

## Set up

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

{% hint style="warning" %}
For `EXTERNAL_ID`, it is recommended to use a fixed value as it is an important value used 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

```java
void setIdentity(DFIdentity identity, String value)
```

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

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

```java
DfineryProperties.setIdentity(DFIdentity.EXTERNAL_ID, "IDENTITY_VALUE");
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
DfineryProperties.setIdentity(DFIdentity.EXTERNAL_ID, "IDENTITY_VALUE")
```

{% endtab %}
{% endtabs %}

### Set multiple items at once

```java
void setIdentities(Map<DFIdentity, String> values)
```

* `values` : You must enter the type and value of user identification information in the form of `java.util.Map<DFIdentity, String>`. `null`cannot be entered `values`.

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

```java
Map<DFIdentity, String> identities = new HashMap<>();
identities.put(DFIdentity.EXTERNAL_ID, "IDENTITY_VALUE");
identities.put(DFIdentity.EMAIL,"IDENTITY_VALUE");
identities.put(DFIdentity.PHONE_NO, "821012345678");
DfineryProperties.setIdentities(identities);
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
val identities = mapOf<DFIdentity, String>(
    DFIdentity.EXTERNAL_ID to "IDENTITY_VALUE", 
    DFIdentity.EMAIL to "IDENTITY_VALUE",
    DFIdentity.PHONE_NO to "821012345678"
)
DfineryProperties.setIdentities(identities)
```

{% endtab %}
{% endtabs %}

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

## Reset user identification information

You can remove and initialize any previously stored user identification information by calling the `DfineryProperties.resetIdentity` method.

{% 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="Java" %}

```java
DfineryProperties.resetIdentity();
```

{% endtab %}

{% tab title="Kotlin" %}

```java
DfineryProperties.resetIdentity()
```

{% endtab %}
{% endtabs %}

## Learn more

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.
