A QR code for software moves a person between devices: desktop to phone, laptop to authenticator, printed card to help article. Common jobs are app downloads, two-factor setup and links to the exact help page.
The design matters because some of these codes carry secrets. A code that holds a secret must be shown once, over HTTPS, inside the session that needs it.
This guide covers where QR codes fit in a product, what an authenticator QR code contains, safe device pairing, app store handoffs on iOS and Android, and which documentation and event codes can stay static.
Where do QR codes make sense in a software product?
A QR code helps when two screens must share one piece of information that is slow to type. The table sorts common cases by what the code carries. That decides how carefully you must treat it.
| Use | What the code carries | Is it a secret? | Static or dynamic |
|---|---|---|---|
| App download | A redirect URL | No | Dynamic redirect on your domain |
| Two-factor enrollment | An otpauth:// URI with the shared secret | Yes | Generated per user, never printed |
| Device login or pairing | A short-lived session token | Yes, for a minute or two | Generated per attempt |
| Docs on a device or manual | A path on your domain | No | Redirect you keep alive |
| Trade show banner | A demo or trial sign-up link | No | Dynamic, tagged per event |
| Conference slide | A repository or sample link | No | Static is fine |
The two rows marked as secrets need engineering work. The rest are ordinary links.
The app download guide and the trade show signage guide cover the ordinary links. Static codes never expire. Use dynamic codes only where the destination may change.
What is inside a two-factor QR code?
A two-factor QR code holds an otpauth://totp/ URI, and that URI contains the shared secret. Google's Key URI Format documentation describes the format.
The authenticator app reads the URI and stores the secret. From then on, it computes a six-digit time-based code with the TOTP algorithm in RFC 6238. TOTP builds on the HMAC one-time password method in RFC 4226.
otpauth:// URI and which ones matter.The documented example is otpauth://totp/Example:alice@google.com?secret=JBSWY3DPEHPK3PXP&issuer=Example. The Key URI page lists the parameters:
secretis required, Base32-encoded, padding omitted.issueris strongly recommended and should match the prefix in the label.algorithm(SHA1 default),digits(6 default) andperiod(30 default) are optional, and the page says Google Authenticator currently ignoresalgorithmandperiod, anddigitson Android.
That last point matters in practice. Say your server uses 8 digits or a 60-second period. Some authenticator apps will quietly use the default 6 digits and 30 seconds, and your users' codes will never match.
Stay on the defaults unless you have tested every app you support. RFC 6238 recommends a 30-second step and at most one step of allowed network delay. Its drift example accepts two steps back.
The secret sits in the pattern, so the QR code is the credential. Anyone who photographs or screenshots it can generate valid codes for that account.
The QuickQRC 2FA QR code generator builds the URI in the browser. A secret you type for testing is not sent to a server. Use it for test accounts and documentation, never for real user secrets.
How should an enrollment flow handle the secret?
Generate the secret on your server for one signed-in user, show it once, and discard the display. The QR code must never reach email, logs, tickets or a third-party image service.
- Require the user to be signed in and, for sensitive accounts, to re-enter their password.
- Generate a random secret and show the QR code over HTTPS with caching disabled. Offer the Base32 string as a manual entry key for people who cannot scan.
- Do not activate the factor until the user types a valid code. This proves the app stored the secret correctly.
- Show single-use recovery codes once, and store only hashed versions.
- Render the QR image yourself, in the page or from a library you host, rather than calling a public QR image API with the secret in the URL.
OWASP's Multifactor Authentication Cheat Sheet makes the same points about single-use recovery codes. It also says to handle one-time codes like passwords.
RFC 6238 says the verifier must not accept a second attempt of a code it already validated.
The OWASP cheat sheet describes TOTP as short-lived but open to phishing. It prefers FIDO2 and WebAuthn authenticators, which bind sign-in to the genuine site.
If you offer passkeys, the Google passkey QR code guide explains the cross-device prompt users will see.
How do you design device pairing and QR login safely?
Make each login code short-lived, single-use and bound to its session, and confirm on the phone.
Messaging web clients made QR login familiar. The desktop shows a code, a signed-in phone scans it, and the desktop is logged in.
The weakness: the person who scans may not be the person at the desktop.
The OWASP community page on QRLJacking describes the attack. An attacker copies a live login QR code onto a phishing page and keeps it refreshed with a script. When a victim scans it in the real app, the attacker's session is authorized.
The OWASP page lists WhatsApp and AirDroid as example targets. It notes that some services do not enforce expiration.
OWASP's mitigations map onto concrete design choices:
- Make the code expire quickly and work once. Pick the lifetime by testing real users; a minute or two is a common starting point, and the right number is yours to set.
- Bind it to the session that displayed it, so a copy on another page is useless.
- Make the phone show which device, browser and approximate place is asking, and require an explicit approve tap. This is the confirmation step OWASP recommends.
- Consider restricting by network or location for high-risk accounts, and avoid QR login entirely where you do not need it.
Tell users in plain words never to scan a login code that someone sends them. The same goes for a code on a page they did not open themselves.
The QR code safety guide and how to check QR code safety cover the wider scam picture.
How does an app store handoff work on each platform?
A redirect on your domain sends iPhones to the App Store, Android phones to Google Play, and desktops to a landing page. A desktop browser cannot install a phone app, so it should reach neither store.
| Approach | Works for | Trade-off |
|---|---|---|
| Direct store link | An iOS-only or Android-only app | Wrong store for the other platform |
| Dynamic smart redirect | Both platforms, one printed code | Depends on the redirect service staying up |
| Landing page with both badges | Mixed audiences and desktop visitors | One extra tap |
Run the redirect for printed codes on a domain you own. A store URL change then does not strand manuals or packaging.
Once the app is installed, links should open it directly. Android calls this App Links. The system checks a Digital Asset Links file at /.well-known/assetlinks.json on each hostname in your intent filters. If verification fails, links do not open in your app automatically.
Apple's equivalent, universal links, uses an association file on your domain. Vendor guides place it at /.well-known/apple-app-site-association. Confirm the details in Apple's documentation.
The dynamic app store QR code builds the redirect for you. The app download guide goes deeper.
Should documentation and event links be static or dynamic?
Route printed documentation codes through a redirect you control; slide and event codes can be simpler. Documentation URLs change when docs are restructured.
For a code etched onto a device or printed in a manual, use a path you control, such as docs.example.com/q/setup. Keep that redirect alive for the life of the product.
A conference slide is temporary, so a static link to the current page is fine.
At trade shows, a dynamic code tagged per event shows which booth or talk produced sign-ups. The UTM builder adds the tags. The tracking guide explains what the counts mean.
A vCard code on a sales rep's badge saves typing contact details.
A booth screen is read at an angle and under bright light. Check every printed code against the print size guide and the scannability tester before the print run.
What does a rollout checklist look like?
Mark which codes carry secrets, lock those down, and own every redirect.
- List every place a QR code appears in the product, packaging and marketing, and mark which carry a secret.
- For secret-bearing codes, confirm HTTPS, no caching, no logging of the URI, and a short lifetime or one-time display.
- Test the enrollment with the authenticator apps your users have, using the default digits and period.
- Add a manual entry key and recovery codes before launch.
- Put pairing approvals on the phone, showing device and place.
- Host redirects for printed codes on your own domain and write down who owns them.
- Verify App Links and universal link files after every domain or certificate change.
- Scan every printed code on real phones before printing in volume.
What are the common mistakes?
The worst mistake is letting an enrollment QR code leave the signed-in session.
Imagine a small SaaS team that emails new users their 2FA QR code "to make setup easier". An inbox forwarded to a shared mailbox now holds a permanent credential.
In the same release, the team prints the docs link on 2,000 device boxes. It points straight at a help page that is renamed three months later.
Both mistakes were avoidable. Show the enrollment code only in the signed-in session. Print a redirect on your own domain.
Other common mistakes:
- Emailing, logging or screenshotting an enrollment QR code.
- Using non-default digits or period values that some authenticator apps ignore.
- Sending the secret to a public QR image service in a URL.
- Letting login codes live for minutes and stay valid after use.
- Approving a pairing without showing the user which device is asking.
- Opening a store page from a desktop browser that cannot install the app.
What questions does the checklist not settle?
Your own testing and security review settle what a checklist cannot.
The right lifetime for a pairing code depends on how your users behave. Only your own testing can set it.
Authenticator apps differ in which URI parameters they honor, and that changes over time. Retest after major app updates.
Passkeys and WebAuthn may replace TOTP for your highest-risk accounts. The cross-device standards behind them are still evolving.
This guide is general information, not security or legal advice. Have your own security review cover any flow that carries a secret.
References
- Google Authenticator: Key URI Format
- IETF RFC 6238: TOTP, Time-Based One-Time Password Algorithm
- IETF RFC 4226: HOTP, HMAC-Based One-Time Password Algorithm
- OWASP: Multifactor Authentication Cheat Sheet
- OWASP: QRLJacking
- Android Developers: verify Android App Links
- ISO/IEC 18004:2024, QR code bar code symbology specification