You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
724 B

import binascii
import requests
from decouple import config
from pyotp import TOTP
def check_otp(name, realm, token):
data = {
"auth_name": config("AUTH_NAME", ""),
"auth_token": TOTP(config("AUTH_SEED", "")).now(),
"auth_realm": config("AUTH_REALM", ""),
"name": name,
"realm": realm,
"token": token,
except binascii.Error:
return 400
response =
OTP_SERVER=config("OTP_SERVER", ""),
return response.status_code