Here's an example of a rspec test helper that will let you sign in as a given user.
Create spec/support/helpers/authentication.rb
with the following:
module Helpers
module Authentication
def sign_in_as(user)
<!-- Insert in head --> | |
<!-- Custom Browsers Color Start --> | |
<!-- Chrome, Firefox OS and Opera --> | |
<meta name="theme-color" content="#000"> | |
<!-- Windows Phone --> | |
<meta name="msapplication-navbutton-color" content="#000"> | |
<!-- iOS Safari --> | |
<meta name="apple-mobile-web-app-status-bar-style" content="#000"> | |
<!-- Custom Browsers Color End --> |
*update: TBC, but this new might affect how easy it is to use this technique past August 2024: Authy is shutting down its desktop app | The 2FA app Authy will only be available on Android and iOS starting in August
This gist, based in part on a gist by Brian Hartvigsen, allows you to export from Authy your TOTP tokens you have stored there.
Those can be "standard" 6-digits / 30 secs tokens, or Authy's own version, the 7-digits / 10 secs tokens.