{"id":24857,"library":"yubico-client","title":"yubico-client","description":"A Python library for verifying YubiKey One Time Passwords (OTPs) via the Yubico validation API. Version 1.13.0 is stable with infrequent releases.","status":"active","version":"1.13.0","language":"python","source_language":"en","source_url":"https://github.com/Kami/python-yubico-client/","tags":["yubico","otp","security","authentication"],"install":[{"cmd":"pip install yubico-client","lang":"bash","label":"stable"}],"dependencies":[],"imports":[{"note":"Standard import path since 1.0.","symbol":"Yubico","correct":"from yubico_client import Yubico"}],"quickstart":{"code":"import os\nfrom yubico_client import Yubico\n\nclient_id = os.environ.get('YUBICO_CLIENT_ID', '')\nsecret_key = os.environ.get('YUBICO_SECRET_KEY', '')\nyubi = Yubico(client_id, secret_key)\notp = 'ccccccbcvghfvbjfbbgvhu'  # example OTP\nif yubi.verify(otp):\n    print('OTP is valid')\nelse:\n    print('OTP verification failed')","lang":"python","description":"Verify a YubiKey OTP using the Yubico validation API."},"warnings":[{"fix":"Update imports to 'from yubico_client import Yubico'.","message":"In version 1.0, the import changed: 'import yubico' no longer works; use 'from yubico_client import Yubico'.","severity":"breaking","affected_versions":">=1.0"},{"fix":"Set environment variables YUBICO_CLIENT_ID and YUBICO_SECRET_KEY.","message":"The library uses the Yubico validation API v2. You must have a client ID and secret key from Yubico. Without them, verify() will raise an exception.","severity":"gotcha","affected_versions":"all"},{"fix":"Use try/except around verify() to get exceptions like YubicoVerificationError.","message":"verify() returns True/False, not a Yubico response object. For detailed failure reasons, catch exceptions from yubico_client.errors.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'pip install yubico-client' and use 'from yubico_client import Yubico'.","cause":"Installed old 'yubico' package or forgot to install yubico-client.","error":"ImportError: No module named yubico_client"},{"fix":"Change import to 'from yubico_client import Yubico'.","cause":"Used old import 'import yubico' instead of 'from yubico_client import Yubico'.","error":"AttributeError: module 'yubico_client' has no attribute 'Yubico'"},{"fix":"Check YUBICO_CLIENT_ID and YUBICO_SECRET_KEY values. Generate credentials at https://upgrade.yubico.com/getapikey/.","cause":"Invalid client ID or secret key, or missing environment variables.","error":"yubico_client.errors.YubicoVerificationError: No such client"},{"fix":"Ensure OTP is a 44-character string from a YubiKey. Example: 'ccccccbcvghfvbjfbbgvhu'.","cause":"OTP string is malformed or not a valid YubiKey OTP.","error":"yubico_client.errors.YubicoVerificationError: Bad OTP"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}