# Handling URL Scheme

To receive incoming deep-link to your RedirectURL from the trusted webview, you need to add some setup your project.

{% tabs %}
{% tab title="Android" %}
You can check this [complete guide on deep-links in Android](https://developer.android.com/training/app-links/deep-linking).

### Add Intent Filter to Receive Incoming Link

Here's an example on receiving an incoming link of `cotterexample://login`

{% code title="AndroidManifest.xml" %}

```markup
<activity android:name="com.example.cotterexample.Login">
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <!-- Accepts URIs that begin with "cotterexample://login" -->
        <data android:scheme="cotterexample"
            android:host="login" />
    </intent-filter>
</activity>
```

{% endcode %}

### Read data from incoming intents <a href="#handling-intents" id="handling-intents"></a>

You should generally do this during [`onCreate()`](https://developer.android.com/reference/android/app/Activity.html#onCreate\(android.os.Bundle\)) or [`onStart()`](https://developer.android.com/reference/android/app/Activity.html#onStart\(\))

```java
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    // Read data from incoming intents 
    Intent intent = getIntent();
    if (Intent.ACTION_VIEW.equals(intent.getAction())) {
        Uri uri = intent.getData();
        // Use this data to perform your http request to get Cotter token 
        String authCode = uri.getQueryParameter(AUTH_CODE);
        String state = uri.getQueryParameter(STATE);
        String challengeID = uri.getQueryParameter(CHALLENGE_ID);
    }
}
```

{% endtab %}

{% tab title="Second Tab" %}

{% endtab %}
{% endtabs %}
