Authenticate from a Non-Trusted Device
Step 1: Making an Authentication Request
Cotter.signInWithDevice(this, userEmail, this, Dashboard.class, new Callback() {
@Override
public void onSuccess(JSONObject result) {
Toast.makeText(getApplicationContext(), result.toString(), Toast.LENGTH_SHORT).show();
Log.e("Success authenticating user", result.toString() );
}
@Override
public void onError(String error) {
Toast.makeText(getApplicationContext(), error, Toast.LENGTH_SHORT).show();
}
});{
"ID": 1361, // Event ID
"CreatedAt": "2020-02-27T22:22:48.705212512Z",
"UpdatedAt": "2020-02-27T22:22:48.705212512Z",
"DeletedAt": null,
"client_user_id": "abcdefgh-abcd-abcd-abcd-af968d9951d3", // your user's Cotter User ID
"issuer": "YOUR API KEY ID", // your API Key
"event": "LOGIN",// requested event (LOGIN, or TRANSACTION, etc)
"ip": "192.168.232.2",
"location": "Unknown",
"timestamp": "1582842167",
"method": "TRUSTED_DEVICE", // auth method: TRUSTED_DEVICE (other choices are PIN / BIOMETRIC)
"new": false, // Is this a new pending event. More explanation below about Non-Trusted Device
"approved": true // Is this event approved.
// If authentication successful:
// Validate the oauth_token.access_token
"oauth_token": {
"access_token": "eyJhbGciOiJFUz...", // validate this access token
"id_token": "eyJhbGciOiJFUz...",
"refresh_token": "5:cYIfabtspE1cBeD7KP...",
"expires_in": 3600,
"token_type": "Bearer",
"auth_method": "TRUSTED_DEVICE"
}
}Callback Class
Case 1: The current device is a Trusted Device
Case 2: The current device is NOT a Trusted Device
Step 2: How to approve a pending request from a Trusted Device

Receiving the result and check if the request was approved
Case 1: The request is approved
Handle the response in your callback class
Case 2: The request is rejected

Last updated