Handling URL Scheme
To receive incoming deep-link to your RedirectURL from the trusted webview, you need to add some setup your project.
Android
Second Tab
Here's an example on receiving an incoming link of cotterexample://login
AndroidManifest.xml
1
<activity android:name="com.example.cotterexample.Login">
2
<intent-filter>
3
<action android:name="android.intent.action.VIEW" />
4
<category android:name="android.intent.category.DEFAULT" />
5
<category android:name="android.intent.category.BROWSABLE" />
6
<!-- Accepts URIs that begin with "cotterexample://login" -->
7
<data android:scheme="cotterexample"
8
android:host="login" />
9
</intent-filter>
10
</activity>
Copied!

Read data from incoming intents

You should generally do this during onCreate() or onStart()​
1
@Override
2
public void onCreate(Bundle savedInstanceState) {
3
super.onCreate(savedInstanceState);
4
setContentView(R.layout.main);
5
​
6
// Read data from incoming intents
7
Intent intent = getIntent();
8
if (Intent.ACTION_VIEW.equals(intent.getAction())) {
9
Uri uri = intent.getData();
10
// Use this data to perform your http request to get Cotter token
11
String authCode = uri.getQueryParameter(AUTH_CODE);
12
String state = uri.getQueryParameter(STATE);
13
String challengeID = uri.getQueryParameter(CHALLENGE_ID);
14
}
15
}
Copied!
​
​
Copy link