ThreatPrevent
ThreatPrevent
Cyber Trust Intelligence
OAuth 2.0

Device Authorization

Use the device flow for command-line tools and devices that cannot safely host a browser callback or protect a client secret.

1. Request device codes

Device authorization
curl -sS -X POST https://api.threatprevent.io/oauth/device_authorization \
+  -H 'Content-Type: application/x-www-form-urlencoded' \
+  --data-urlencode 'client_id=CLIENT_ID' \
+  --data-urlencode 'scope=risk:payment offline_access'

Show the returned user_code and verification URI to the user. Prefer opening verification_uri_complete when the device supports it.

2. Poll the token endpoint

Polling request
curl -sS -X POST https://api.threatprevent.io/oauth/token \
+  -H 'Content-Type: application/x-www-form-urlencoded' \
+  --data-urlencode 'grant_type=urn:ietf:params:oauth:grant-type:device_code' \
+  --data-urlencode 'client_id=CLIENT_ID' \
+  --data-urlencode 'device_code=DEVICE_CODE'

Wait at least the returned interval between requests. Continue on authorization_pending; increase the interval on slow_down; stop on denial, expiry or another terminal error.

Configure this as a Public / Native or CLI client with token authentication None. A public device client must not be issued a client secret.