How to Use Google Authenticator with Swift2FA
Learn how to move from a Google Authenticator QR code or secret key into Swift2FA so you can generate matching desktop codes.
Start with the same secret
Swift2FA and Google Authenticator will only generate the same code if they use the same secret key and the same TOTP settings. In practice, that means the original QR code or Base32 secret must be identical on both sides.
If you scan the setup QR during enrollment, you are importing the same secret that Google Authenticator would use on a phone.
Two easy ways to import data
You can paste the Base32 secret directly into Swift2FA, or you can decode the QR code locally if all you still have is the image or `otpauth://` link.
The QR path is often easier because it preserves settings like digit length, hash algorithm, issuer, and period without manual copying mistakes.
How to confirm the codes match
Generate a fresh code in Swift2FA and compare it to Google Authenticator within the same 30-second window. If they do not match, the problem is usually one of three things: the secret is different, the device clock is off, or the QR settings were not preserved.
The safest time to test this is while you still have access on both devices, not after you have already lost the original authenticator.
When this workflow is most useful
Using Swift2FA alongside Google Authenticator is helpful for desktop logins, recovery planning, migrations to a new phone, or validating that a stored secret still works.
It is also useful if you want a second trusted place to verify that a QR code was decoded correctly before you depend on it.
FAQ
Will Swift2FA always match Google Authenticator?
Yes, if both are using the same secret and the same TOTP settings, and the device clocks are close enough to each other.
Why are my codes different?
The most common reasons are a mismatched secret, an incomplete QR import, or clock drift on one of the devices.
Keep Exploring
Generate a fresh code with our 2FA generator, decode an authenticator QR code, or browse more security guides below.