BeyondDimension/SteamTools · warning · ApplicationException

Import only supports otpauth://

Error message

Import only supports otpauth://

What it means

Thrown during authenticator import when a parsed URI's scheme is not 'otpauth'. The importer only understands the otpauth:// URI format (RFC 6238-style), so any other scheme (http, https, steam://, bare text) is rejected at the scheme check before host/path validation.

Source

Thrown at src/BD.WTTS.Client.Plugins.Authenticator/UI/ViewModels/AuthenticatorImportPageViewModel.cs:266

                {
                    continue;
                }

                // bug if there is a hash before ?
                var hash = line.IndexOf("#", StringComparison.Ordinal);
                var qm = line.IndexOf("?", StringComparison.Ordinal);
                if (hash != -1 && hash < qm)
                {
                    line = $"{line.Substring(0, hash)}%23{line[(hash + 1)..]}";
                }

                // parse and validate URI
                var uri = new Uri(line);

                // we only support "otpauth"
                if (uri.Scheme != "otpauth")
                {
                    throw new ApplicationException("Import only supports otpauth://");
                }

                // we only support totp (not hotp)
                if (uri.Host != "totp" && uri.Host != "hotp")
                {
                    throw new ApplicationException("Import only supports otpauth://totp/ or otpauth://hotp/");
                }

                // get the label and optional issuer
                string issuer = string.Empty;
                string label = string.IsNullOrEmpty(uri.LocalPath) == false
                    ? uri.LocalPath[1..]
                    : string.Empty; // skip past initial /
                int p = label.IndexOf(":", StringComparison.Ordinal);
                if (p != -1)
                {
                    issuer = label.Substring(0, p);
                    label = label[(p + 1)..];

View on GitHub (pinned to c16ffa08e0)

Solutions

  1. Re-export from the source authenticator as an otpauth:// URI (standard QR format).
  2. Strip any leading/trailing whitespace or stray prefix from the imported line before parsing.
  3. If migrating from a tool using a different format, convert each entry to otpauth:// first.
  4. Validate the scheme in the UI and show a friendly message instead of throwing.

Example fix

// before
if (uri.Scheme != "otpauth")
    throw new ApplicationException("Import only supports otpauth://");

// after: friendly, localized validation
if (uri.Scheme != "otpauth")
    throw new ArgumentException(string.Format(Strings.Import_UnsupportedScheme, uri.Scheme));
Defensive patterns

Strategy: validation

Validate before calling

// Validate scheme before parsing the entry.
static bool IsOtpAuthUri(string line)
{
    if (string.IsNullOrWhiteSpace(line)) return false;
    try { return new Uri(line.Trim()).Scheme.Equals("otpauth", StringComparison.OrdinalIgnoreCase); }
    catch (UriFormatException) { return false; }
}

if (!IsOtpAuthUri(line))
    errors.Add(($"Line {n}: not an otpauth:// URI.", line));

Type guard

bool IsOtpAuth(string line) => Uri.TryCreate(line?.Trim(), UriKind.Absolute, out var u) && u.Scheme == "otpauth";

Try / catch

try { ParseAuthenticator(line); }
catch (ApplicationException ex) when (ex.Message == "Import only supports otpauth://")
{
    importErrors.Add(($"Unsupported URI scheme (line {n}).", line));
    continue; // skip entry, keep importing the rest
}

Prevention

When it happens

Trigger: Importing a line/QR content whose URI scheme is not otpauth — e.g. a plain URL, a 'steam://' link, a google otpauth typo, or a non-URI string that happened to parse as a Uri with a different scheme.

Common situations: User scanned the wrong QR code (a URL instead of an otpauth code); export file from another manager uses a different scheme; copy-paste included extra prefix text; legacy 'otpauth' typos like 'otp-auth://' or 'http://otpauth'.

Related errors


AI-assisted analysis of BeyondDimension/SteamTools@c16ffa08e0 (2026-08-13). Data as JSON: /api/errors/1d9c9a5676bc3017. Report an issue: GitHub.