Using HTTP Requests
Other than the current flow in the SDK, you can also request for OAuth Tokens using http requests directly to Cotter's server.
You need to have either:

Getting Tokens using Identity Token

After successfully verifying user's email or phone number, you'll receive Cotter's Identity Token. Pass it to the body of the request under field identity_token
1
curl -XPOST \
2
-H 'API_KEY_ID: <YOUR API KEY ID>' \
3
-H 'API_SECRET_KEY: <YOUR API SECRET KEY>' \
4
-H "Content-type: application/json" \
5
-d '{
6
"grant_type": "identity_token",
7
"identity_token": { // πŸ‘ˆ Put Identity Token Here
8
"expire_at": "1588849208",
9
"identifier": "[email protected]",
10
"identifier_id": "e8a47aff-f520-4b8d-952b-79d36d10fb3e",
11
"identifier_type": "EMAIL",
12
"receiver": "<YOUR API KEY ID>",
13
"signature": "21P6mXSF2x357kZGkEMQTRTn3r...",
14
"timestamp": "1586257208"
15
}
16
}' 'https://www.cotter.app/api/v0/token'
Copied!
post
https://www.cotter.app
/api/v0/token
Getting Tokens using Identity Token

Getting Tokens using Event Token

After successfully authenticating users using Trusted Devices, you will receive Cotter's Event Token. Pass it to the body of the request under field event_token
1
curl -XPOST \
2
-H 'API_KEY_ID: <YOUR API KEY ID>' \
3
-H 'API_SECRET_KEY: <YOUR API SECRET KEY>' \
4
-H "Content-type: application/json" \
5
-d '{
6
"grant_type": "event_token",
7
"event_token": { // πŸ‘ˆ Put Event Token Here
8
"CreatedAt": "2020-04-07T11:09:03.246703978Z",
9
"DeletedAt": null,
10
"ID": 264,
11
"UpdatedAt": "2020-04-07T11:09:03.246703978Z",
12
"approved": true,
13
"client_user_id": "xyzABC123",
14
"event": "LOGIN",
15
"ip": "73.15.208.6",
16
"issuer": "<YOUR API KEY ID>",
17
"location": "San Francisco",
18
"method": "TRUSTED_DEVICE",
19
"new": false,
20
"signature": "CLQUgAUEuMebLAEQ...",
21
"timestamp": "1586257743"
22
}
23
}' 'https://www.cotter.app/api/v0/token'
Copied!
post
https://www.cotter.app
/api/v0/token
Getting Tokens using Event Token