GET
https://api.cryptohopper.com/v1/user/validatetwofactor
Checks a two-factor authentication code of the user. A wrong code returns HTTP 400 with "Invalid 2FA code."
OAuth scope:
user About scopes
A valid emergency one-time password is used up by this call. Accounts without two-factor authentication accept any non-empty code.
Example request
curl "https://api.cryptohopper.com/v1/user/validatetwofactor?code=CODE" \
-H "access-token: YOUR_ACCESS_TOKEN"
const response = await fetch('https://api.cryptohopper.com/v1/user/validatetwofactor?code=CODE', {
method: 'GET',
headers: {
"access-token": "YOUR_ACCESS_TOKEN"
}
});
const data = await response.json();
import requests
response = requests.get(
"https://api.cryptohopper.com/v1/user/validatetwofactor",
headers={
"access-token": "YOUR_ACCESS_TOKEN"
},
params={
"code": "CODE"
},
)
data = response.json()
$ch = curl_init('https://api.cryptohopper.com/v1/user/validatetwofactor?code=CODE');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'access-token: YOUR_ACCESS_TOKEN',
],
]);
$data = json_decode(curl_exec($ch), true);
Parameters
Headers
| Name | Type | Required | Description |
|---|---|---|---|
access-token |
string | Required | The OAuth access token of the user. |
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
code |
string | Required | Current code from the user's authenticator app, or one of the user's emergency one-time passwords. |
Response
{
"data": "Successfully authenticated."
}