What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To automate a TOTP login, your authorized automation must have access to the same shared secret as the service, use the service’s time-step and hash settings, calculate the current time counter, and submit the resulting code through the normal protected login flow. RFC 6238 uses a 30-second time step by default, but the verifier’s actual configuration controls what it accepts. Treat the seed as credential material: keep it in a secrets store, out of source control and logs, and restrict access.

What TOTP automation actually does

TOTP is the time-based form of HOTP. HOTP combines a shared secret with a counter; TOTP replaces the event counter with a value derived from Unix time. The prover (an authenticator or your automation) and verifier (the login service) independently calculate a short code and compare it.

RFC 6238 requires both sides to know or derive the current Unix time and to use the same time-step value. Its default step is 30 seconds. The specification is at RFC 6238; the underlying HOTP construction is defined in RFC 4226.

Automation is therefore account-specific. A code generated from another account’s seed, or from a seed transformed differently from the verifier’s copy, will not work. Possessing a seed is equivalent to possessing that account’s OTP credential, so automate only accounts and workflows you are authorized to operate.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Before you write code: collect the verifier’s parameters

An authenticator enrollment URI commonly contains a Base32-encoded secret and parameters such as issuer, account name, algorithm, digits and period. Record the values supplied by the service rather than assuming every deployment uses defaults.

  • Secret: the exact shared seed, normally Base32 encoded. Preserve its value and decode it as the library expects.
  • Time step (period): RFC 6238’s default is 30 seconds, but a service may configure another value.
  • Hash algorithm: SHA-1 is common in legacy provisioning, while the RFC also defines SHA-256 and SHA-512 options. Use the algorithm configured by the verifier.
  • Digits: six digits is common; some systems use eight.
  • Time basis: both sides need a current Unix-time basis. UTC is implicit in Unix time; local display time is irrelevant.

If you do not have the seed or cannot determine these settings, do not guess. Re-enroll the account through its approved process or ask the service owner for the supported configuration.

Generate a TOTP in Python without an external package

The following implementation follows HOTP/TOTP’s standard dynamic-truncation construction. It accepts a Base32 seed, computes the counter from Unix time and a configurable period, and returns a zero-padded code. It is an example for an authorized integration, not a way to bypass MFA.

import base64
import hashlib
import hmac
import struct
import time


def totp(secret_base32, *, at=None, period=30, digits=6,
         algorithm="SHA1"):
    if period <= 0 or digits <= 0:
        raise ValueError("period and digits must be positive")

    # Provisioning strings often contain spaces or hyphens.
    normalized = "".join(secret_base32.split()).replace("-", "")
    key = base64.b32decode(normalized.upper(), casefold=True)
    timestamp = int(time.time() if at is None else at)
    counter = timestamp // period
    message = struct.pack(">Q", counter)

    digestmod = {
        "SHA1": hashlib.sha1,
        "SHA256": hashlib.sha256,
        "SHA512": hashlib.sha512,
    }[algorithm.upper()]
    digest = hmac.new(key, message, digestmod).digest()
    offset = digest[-1] & 0x0F
    binary = ((digest[offset] & 0x7F) << 24 |
              (digest[offset + 1] & 0xFF) << 16 |
              (digest[offset + 2] & 0xFF) << 8 |
              (digest[offset + 3] & 0xFF))
    return str(binary % (10 ** digits)).zfill(digits)

# Retrieve this from a secrets manager, not from source code.
secret = "YOUR_BASE32_SECRET"
print(totp(secret, period=30, digits=6, algorithm="SHA1"))

Do not print the seed, the complete login response, or the generated code in production logs. If you need diagnostics, log a request identifier and a redacted status only. Read the secret at runtime from your organization’s approved secret store and give the process the narrowest possible permission.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Using a TOTP library in an application

A maintained library can handle provisioning formats and algorithm details, but its defaults still have to match the verifier. The integration pattern is:

  1. Load the account’s seed from protected storage.
  2. Instantiate the library with the configured period, digits and hash algorithm.
  3. Generate the code immediately before submitting the login request.
  4. Send it over the service’s authenticated, encrypted channel and discard the value after use.
  5. Handle rejection without repeatedly retrying the same value; wait for a newly generated step when policy permits.

Do not copy a seed into a CI variable that is visible to every job, embed it in a mobile or browser bundle, or place it in a URL. Rotate or revoke the enrollment if the seed may have been exposed.

Why a correct-looking code is rejected

Clock drift

The most common cause is a system clock that differs from the verifier. Synchronize the host with an approved time source and check the Unix timestamp, not just the displayed local time. NIST says the verifier’s validity lifetime should account for expected clock drift, network delay and the time a claimant needs to enter the OTP.

Wrong period, digits or algorithm

A 30-second, six-digit SHA-1 calculation is only a default. Compare the enrollment parameters with the service configuration. A correct secret with a 60-second period, eight digits or SHA-256 mismatch will still fail.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

Damaged or altered Base32 data

Remove presentation spaces or hyphens only as appropriate, preserve the actual characters, and decode case-insensitively. Do not silently replace characters or copy a QR payload from an untrusted intermediary.

Submitting at a boundary

A code can expire while a request is in flight. Generate it immediately before submission and account for network and user-entry delay. Expanding the verifier’s acceptance window is not free: it increases the period in which a captured value might be accepted.

Account or enrollment mismatch

Each prover should have a unique key. Confirm that the automation is using the seed for the intended account and that the service has not reset or replaced the enrollment. If the seed is uncertain, revoke and enroll a new one through the service’s normal recovery process.

Verifier responsibilities: replay, channel and rate limits

Automation does not remove the verifier’s security obligations. NIST SP 800-63B-4, published in July 2025 for government information systems, requires strong protection of the shared key, an approved encrypted and authenticated channel for collecting the OTP, acceptance of a given OTP only once while it is valid, and effective rate limiting of failed attempts. See NIST’s authenticator guidance. That guidance is not automatically a legal requirement for every private service, but it is a useful security baseline.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
  • Replay prevention: record successful OTP use and reject the same value again during its validity period. A time window alone does not prevent replay.
  • Rate limiting: throttle failures per account, credential, source and other relevant dimensions. Short numeric codes are designed to be guessed eventually without limits.
  • Secret protection: protect every duplicate of the seed, including backups, job artifacts and support exports.
  • Protected collection: submit codes only through the real service endpoint over an authenticated, encrypted channel. Never send them to a page or service you have not verified.

Is TOTP phishing-resistant?

No. NIST states plainly, “OTP authentication is not phishing-resistant.” A manually entered TOTP is not cryptographically bound to the website, device or login session. A phishing site can ask for the current code and relay it to the real verifier before it expires. Automation can reduce typing and transcription errors, but it does not change this property.

Use a phishing-resistant method, such as a verifier-bound authenticator, when the service and threat model require that protection. TOTP remains useful as an additional factor and as a compatibility method, but do not describe it as phishing-resistant.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Testing and operating an authorized workflow

Test against a non-production account or the service’s documented test environment. Fix the time source and configuration before investigating application code. Keep the following checks in your runbook:

  • Secret is retrieved at runtime and is absent from repositories, images, tickets and ordinary logs.
  • Host time is synchronized and monitored.
  • Period, digits and hash algorithm are explicit configuration, not hidden defaults.
  • Code generation happens immediately before the login request.
  • Retries do not replay a previously accepted value.
  • Failures trigger bounded backoff and alerting rather than an unbounded loop.
  • Enrollment revocation and seed rotation are documented.

Or skip the browser setup

If your wider workflow also needs webpage screenshots, ScreenshotNeo is a separate website screenshot API and MCP server; it does not generate TOTP codes. One GET request returns a PNG, JPEG, WebP or PDF:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo documentation for options. Before capture it can accept cookie banners and remove more than 60 known consent platforms, newsletter popups and chat widgets. Bot checks, blank pages, timeouts, failed loads and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info and capture_pdf for Claude, Cursor and other MCP clients. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots.

Create a free ScreenshotNeo account to start with 1,000 screenshots a month and no card.

Frequently Asked Questions

Can TOTP generation work without an internet connection?

Yes. Code calculation needs the seed and a sufficiently accurate local clock; network access is needed only to reach the verifier and complete the login flow.

Does automating TOTP eliminate the need for a second factor?

No. The automation is the second-factor prover, and protecting its seed is essential. Anyone who obtains that seed can generate the same codes until enrollment is revoked.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Is a hardware token required for TOTP automation?

No. TOTP is software functionality as well as a capability found in some hardware authenticators. The standards do not require a physical device for code-generation automation.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.