Jana kod 6 digit untuk autentikasi dua faktor
BH2Y4PPMZZFZTEQVJBSWY3DPEHPK3PXPGEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQotpauth://totp/SGR95444861_my%3ASGR95444861_my?secret=BH2Y4PPMZZFZTEQV&issuer=SGR95444861_myotpauth://totp/Google%3Auser@gmail.com?secret=JBSWY3DPEHPK3PXP&issuer=Googleotpauth://totp/Microsoft%3Auser@outlook.com?secret=GEZDGNBVGY3TQOJQ&issuer=Microsoft
/api/generate?secret=YOUR_SECRET&webhook_url=WEBHOOK_URL
/generate dengan JSON payload
# GET Request
curl "http://localhost:8000/api/generate?secret=BH2Y4PPMZZFZTEQV&webhook_url=https://hook.make.com/xxx"
# POST Request
curl -X POST http://localhost:8000/generate \
-H "Content-Type: application/json" \
-d '{"secret":"BH2Y4PPMZZFZTEQV","webhook_url":"https://hook.make.com/xxx"}'
// Fetch API
fetch('/generate', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
secret: 'BH2Y4PPMZZFZTEQV',
webhook_url: 'https://hook.make.com/xxx'
})
})
.then(response => response.json())
.then(data => {
console.log('TOTP Code:', data.code);
console.log('Expires in:', data.expires_in, 'seconds');
});
'BH2Y4PPMZZFZTEQV',
'webhook_url' => 'https://hook.make.com/xxx'
]));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
echo "TOTP Code: " . $data['code'];
?>
import requests
import json
# GET Request
params = {
'secret': 'BH2Y4PPMZZFZTEQV',
'webhook_url': 'https://hook.make.com/xxx'
}
response = requests.get('http://localhost:8000/api/generate', params=params)
data = response.json()
print(f"TOTP Code: {data['code']}")
print(f"Expires in: {data['expires_in']} seconds")
# POST Request
payload = {
'secret': 'BH2Y4PPMZZFZTEQV',
'webhook_url': 'https://hook.make.com/xxx'
}
response = requests.post('http://localhost:8000/generate',
json=payload,
headers={'Content-Type': 'application/json'})
data = response.json()
print(f"TOTP Code: {data['code']}")