Skip to content

BUG?: Sometimes get_otpauth_url generates a URL that Free-OTP cannot #768

@moggers87

Description

@moggers87

If the current site is hosted on a non-standard port, e.g. 8000 is used by Django's runserver command, get_otpauth_url will generate a URL that has multiple : in the label section which in turn causes FreeOTP to reject the token as invalid

Expected Behavior

The token is valid, FreeOTP accepts the URL/secret key via QR code and setup can be completed

Current Behavior

FreeOTP throws an error

Possible Solution

According to this document:

Neither issuer nor account name may themselves contain a colon

get_otpauth_url should either strip or replace additional colons

Steps to Reproduce (for bugs)

  1. Start python manage.py runserver
  2. Start 2FA setup
  3. Scan the QR code with FreeOTP

Context

While investigating #767 I ran into this bug and it made going through setup multiple times more of a chore than was necessary.

Your Environment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions