[DOCUMENTED] Error with 2FA using hardware token

I’ve enabled 2FA on one my apps but, if I try to use a hardware token, I get:

AuthenticationFailed: Invalid app origin: <app id>.anvil.app at , line 1
called from anvil-services/anvil/users/mfa/__init__.py, line 19
called from anvil-services/anvil/users/mfa/__init__.py, line 62
AuthenticationFailed: Invalid app origin: <app id>.anvil.app at , line 1
called from anvil-services/anvil/users/mfa/__init__.py, line 19
called from anvil-services/anvil/users/mfa/__init__.py, line 62
AuthenticationFailed: Invalid app origin: <app id>.anvil.app at , line 1
called from anvil-services/anvil/users/mfa/__init__.py, line 19
called from anvil-services/anvil/users/mfa/__init__.py, line 62
AuthenticationFailed: Invalid app origin: <app id>.anvil.app at , line 1
called from anvil-services/anvil/users/mfa/__init__.py, line 19
called from anvil-services/anvil/users/mfa/__init__.py, line 62

Here’s a clone link to a minimal example app which logs in a user but does nothing else. If you attempt to use a hardware token, it raises the error above.

https://anvil.works/build#clone:AGUVGKVWQ6CB7A5H=BBJW4ZHDRE4DXETS75WEL7ND

Hi @owen.campbell

That doesn’t look right! At the very least, that should be presented as a more helpful error message. Bear in mind that 2FA via hardware token will not work when running in the IDE, because the app is in an iframe. If I clone your app, it works correctly for me. Is this happening when you try to use a hardware token for signup or login, and when running in the IDE or directly from the published link?

[Moved to bug reports]

Aha!!! I hadn’t realised that wouldn’t work from within the IDE. That’s exactly the problem.

Thank you.

Okay, thanks, I’ll make sure the docs are updated accordingly!

1 Like