# Authentication

TapTalk.io Omnichannel SDK provides some essential methods to handle user authentication.

### Authenticate User (Optional)

You can authenticate the user that is currently logged in before calling **`presentTapTalkLiveView`** or **`pushTapTalkLiveView`**. To do this, provide the user's full name and email by calling **`authenticateUser`** from the **TapTalkLive** class after initializing the SDK.

<pre class="language-csharp"><code class="lang-csharp"><strong>#import &#x3C;TapTalkLive/TapTalkLive.h>
</strong>
[[TapTalkLive sharedInstance] authenticateUserWithFullName:NAME
                                                     email:EMAIL
success:^(NSString *message) {
    // Successfully authenticated user
}
failure:^(NSError *error) {
        
}];
</code></pre>

{% hint style="info" %}
**Parameters**\
\&#xNAN;**`NAME`**: (NSString \*) current user's full name\
\&#xNAN;**`EMAIL`**: (NSString \*) current user's email address
{% endhint %}

After successfully authenticated, user will no longer be required to fill name and email to create a case.

### Authenticate with Auth Ticket (Optional)

You can also authenticate using an existing auth ticket with **`requestAccessTokenWithAuthTicket`** method from the **TapTalkLive** class after initializing the SDK.

```csharp
#import <TapTalkLive/TapTalkLive.h>

[[TapTalkLive sharedInstance] requestAccessTokenWithAuthTicket:AUTH_TICKET
success:^(NSString *message) {
    // Successfully authenticated user
}
failure:^(NSError *error) {
        
}];
```

{% hint style="info" %}
**Parameters**\
\&#xNAN;**`AUTH_TICKET`**: (NSString \*) existing auth ticket retrieved from the server
{% endhint %}

### Logout

You can clear the currently authenticated user data using the **`logout`** method. After logout is finished, locally saved user and chat data will be cleared, and you may authenticate another user.

```csharp
#import <TapTalkLive/TapTalkLive.h>

[[TapTalkLive sharedInstance] logout:^(NSString *message) {
    // Successfully logged out
}
failure:^(NSError *error) {
    // An error occured, but local data is still cleared
}];
```

### Logout and Clear TapTalkLive Data

Call this method when you need to logout and clear all local cached data from Omnichannel SDK.

```csharp
#import <TapTalkLive/TapTalkLive.h>

[[TapTalkLive sharedInstance] clearAllTapLiveData];
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.taptalk.io/onetalk-omnichannel-documentation/onetalk-channel-integration/live-chat/onetalk-ios/authentication.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
