iMessage 2FA

An Alfred Workflow


Short Description

Find two-factor authentication codes in your recent iMessage messages

Last Updated

05 Nov 2021

Compatibility

Yosemite
(10.10)
Mavericks
(10.9)
Mountain Lion
(10.8)
Lion
(10.7)
Snow Leopard
(10.6)
Yes Yes Yes Yes Yes
 

Version

1.2.8
 

Bundle ID

co.bluehelix.imessage-2fa
 

Author

iMessage 2FA Workflow for Alfred

Find two-factor authentication codes in your recent iMessage messages.

Requirements

  • php must be installed on your system

    • macOS Monterey does not have php preinstalled!
  • We recommend using Homebrew to install php

    • To install Homebrew, follow the instructions on the "Install Homebrew" section of the Homebrew website
    • Once you have installed Homebrew, install php by running brew install php

Installation

  1. Download the latest version of the workflow
  2. Install the workflow by double-clicking the .alfredworkflow file
  3. You can add the workflow to a category, then click "Import" to finish importing. You'll now see the workflow listed in the left sidebar of your Workflows preferences pane.

Configuration

  • By default, only messages received in the past 15 minutes will be searched
  • You can change how many minutes to look back by changing the look_back_minutes workflow variable
  • Tutorial: How to set workflow variables

Usage

Type 2fm to view the most recent two-factor authentication codes from iMessage messages.

Select a 2FA code and do one of the following:

  • Press <enter> to copy it to your clipboard
  • Press ⌘+<enter> (command + enter) to copy it to your clipboard and paste it into the active app window using simulated keystrokes

    • Some websites (e.g. Wells Fargo online banking) don't support pasting a 2FA code, so this will instead simulate typing the code
    • In order for this to work, you MUST grant Alfred automation access to System Events. If you haven't already done so, you will be prompted to grant access. See here for more information about Alfred automation.
  • Press ⌥+<enter> (option + enter) to copy it to your clipboard and paste it into the active app window using the system paste (similar to pressing ⌘+V)

Compatibility

This workflow was developed for use with Alfred 4.

Screenshots