squatto Posted January 29, 2020 Share Posted January 29, 2020 Safari automatically reads your text messages and asks you to auto-fill any two-factor codes it finds: I don't use Safari (I use Chrome) and I was sick of having to manually type the codes from my messages. This workflow reads your message history and finds the most recent 5, 6, 7, or 8 digit two-factor codes. When you select a code and press <enter> it is copied to your clipboard, or you can press <⌘+enter> and it will copy the code to your clipboard and paste it into the active application. Keyword: 2fm Download the latest version: https://github.com/squatto/alfred-imessage-2fa/releases/latest/download/iMessage.2FA.alfredworkflow GitHub: https://github.com/squatto/alfred-imessage-2fa Packal: http://www.packal.org/workflow/imessage-2fa deanishe, JJJJ, Alan He and 3 others 6 Link to comment
deanishe Posted January 29, 2020 Share Posted January 29, 2020 (edited) On my machine (High Sierra), I get the following error: Fatal error: Declaration of Carbon\Translator::setLocale($locale) must be compatible with Symfony\Contracts\Translation\LocaleAwareInterface::setLocale(string $locale) in /Users/username/Dropbox/Config/Alfred 4/Alfred.alfredpreferences/workflows/user.workflow.3238863D-7399-4C90-A171-D38E111D9932/vendor/nesbot/carbon/src/Carbon/Translator.php on line 18 Also, from the README: Quote This was developed for Alfred 4, but it should work with Alfred 3 as well. I haven't checked, but if you made the workflow with Alfred 4 (and it sounds like this is the case), it isn't compatible with Alfred 3, even if it doesn't use any Alfred 4-only features. Just saving a workflow makes it incompatible with earlier major versions of Alfred. Edited January 29, 2020 by deanishe Link to comment
squatto Posted January 30, 2020 Author Share Posted January 30, 2020 20 hours ago, deanishe said: On my machine (High Sierra), I get the following error: Fatal error: Declaration of Carbon\Translator::setLocale($locale) must be compatible with Symfony\Contracts\Translation\LocaleAwareInterface::setLocale(string $locale) in /Users/username/Dropbox/Config/Alfred 4/Alfred.alfredpreferences/workflows/user.workflow.3238863D-7399-4C90-A171-D38E111D9932/vendor/nesbot/carbon/src/Carbon/Translator.php on line 18 Also, from the README: I haven't checked, but if you made the workflow with Alfred 4 (and it sounds like this is the case), it isn't compatible with Alfred 3, even if it doesn't use any Alfred 4-only features. Just saving a workflow makes it incompatible with earlier major versions of Alfred. Thank you for letting me know about this! What version of PHP are you running? That's the result of that error. I will likely need to bring in an earlier version of a package to lower the PHP version that's required. Easily done. Or, I may just remove the Carbon library dependency entirely. It's only there to give you a relative timestamp ("2h ago"). A simple date and time would work just as well. Regarding the Alfred version, that's good to know about the workflow export format. I'll adjust the message to indicate that it's only for Alfred 4. Thank you! Link to comment
deanishe Posted January 30, 2020 Share Posted January 30, 2020 58 minutes ago, squatto said: What version of PHP are you running? 7.1.16 (High Sierra). 59 minutes ago, squatto said: Or, I may just remove the Carbon library dependency entirely. It's only there to give you a relative timestamp ("2h ago") Probably the best idea. That's an awfully big dependency for such a trivial feature. It's pretty easy to write a function for that, too. Link to comment
squatto Posted January 30, 2020 Author Share Posted January 30, 2020 I just released v1.1.0 of the workflow, which removes the Carbon dependency and indicates that only Alfred 4 is supported. Thanks again @deanishe for the feedback! Latest release: https://github.com/squatto/alfred-imessage-2fa/releases/download/v1.1.0/iMessage.2FA.alfredworkflow deanishe 1 Link to comment
deanishe Posted January 30, 2020 Share Posted January 30, 2020 That works. Thanks very much. Have you considered adding a Snippet Trigger? I'm not sure if it would work super-well everywhere (I imagine quite a few 2FA input fields are set to digits only), but it would be very handy where it did work. Link to comment
Cheah Posted February 1, 2020 Share Posted February 1, 2020 Love the idea, unfortunately not working for me on Alfred 4.0.8 and updated php: Not sure what's going on here? Link to comment
deanishe Posted February 1, 2020 Share Posted February 1, 2020 1 hour ago, Cheah said: Not sure what's going on here? We can't tell you what the problem is based on a screenshot of nothing happening. Please post the actual error message from Alfred's debugger. Link to comment
Cheah Posted February 1, 2020 Share Posted February 1, 2020 (edited) Quote [12:29:36.009] Logging Started... [12:29:45.107] iMessage 2FA[Script Filter] Queuing argument '' [12:29:45.276] iMessage 2FA[Script Filter] Script with argv '(null)' finished [12:29:45.280] ERROR: iMessage 2FA[Script Filter] Code 255: Fatal error: Uncaught PDOException: SQLSTATE[HY000] [14] unable to open database file in /Users/Username/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.F5219FED-7165-4B09-AEA1-B2069F06B509/find-messages.php:11 Stack trace: #0 /Users/Username/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.F5219FED-7165-4B09-AEA1-B2069F06B509/find-messages.php(11): PDO->__construct('sqlite:/Users/U…’) #1 {main} thrown in /Users/Username/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.F5219FED-7165-4B09-AEA1-B2069F06B509/find-messages.php on line 11 [12:29:45.281] ERROR: iMessage 2FA[Script Filter] JSON error: JSON text did not start with array or object and option to allow fragments not set. in JSON: Fatal error: Uncaught PDOException: SQLSTATE[HY000] [14] unable to open database file in /Users/Username/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.F5219FED-7165-4B09-AEA1-B2069F06B509/find-messages.php:11 Stack trace: #0 /Users/Username/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.F5219FED-7165-4B09-AEA1-B2069F06B509/find-messages.php(11): PDO->__construct('sqlite:/Users/U...') #1 {main} thrown in /Users/Username/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.F5219FED-7165-4B09-AEA1-B2069F06B509/find-messages.php on line 11 Debug log above UPDATE: For some reason my permissions got reset and didn't have full disk access. Works now. However, Google 2FA is not automatically detected in search results - would love to know how to configure it to search for this. Cheers! Edited February 1, 2020 by Cheah Link to comment
deanishe Posted February 1, 2020 Share Posted February 1, 2020 4 hours ago, Cheah said: However, Google 2FA is not automatically detected in search results - would love to know how to configure it to search for this. Cheers! The workflow searches your Messages.app history for messages that look like they contain a 2FA code. If you posted an example Google 2FA message or two, that would probably make it a lot easier for @squatto to update the workflow accordingly. If you want to adjust your own copy, you'll need to edit the SQL query and regular expression to also match Google 2FA messages. Link to comment
squatto Posted February 2, 2020 Author Share Posted February 2, 2020 On 1/30/2020 at 2:54 PM, deanishe said: That works. Thanks very much. Have you considered adding a Snippet Trigger? I'm not sure if it would work super-well everywhere (I imagine quite a few 2FA input fields are set to digits only), but it would be very handy where it did work. I'll check into that. My only concern with requiring a snippet to be typed into an input field is that many 2fa code inputs are numeric-only, so a prefix to trigger the snippet won't work. I'll see what options there are though. Link to comment
squatto Posted February 2, 2020 Author Share Posted February 2, 2020 On 2/1/2020 at 10:32 AM, Cheah said: Debug log above UPDATE: For some reason my permissions got reset and didn't have full disk access. Works now. However, Google 2FA is not automatically detected in search results - would love to know how to configure it to search for this. Cheers! Thanks for checking into that and for the update on what was happening. I'll make a note to check read permissions on the database file before attempting to run the query. Are the Google 2FA codes like "G-000000"? "G-" and then 6 digits? I could add that in to the matches. Link to comment
squatto Posted February 2, 2020 Author Share Posted February 2, 2020 (edited) I just released v1.2.0 of the workflow, which adds comprehensive error checking and reporting and adds support for Google 2FA codes. Thanks @Cheah for the feedback and for the suggestion! Latest release: https://github.com/squatto/alfred-imessage-2fa/releases/download/v1.2.0/iMessage.2FA.alfredworkflow Edited February 2, 2020 by squatto Linking the release URL Cheah 1 Link to comment
Cheah Posted February 3, 2020 Share Posted February 3, 2020 14 hours ago, squatto said: I just released v1.2.0 of the workflow, which adds comprehensive error checking and reporting and adds support for Google 2FA codes. Thanks @Cheah for the feedback and for the suggestion! Latest release: https://github.com/squatto/alfred-imessage-2fa/releases/download/v1.2.0/iMessage.2FA.alfredworkflow Works like a charm - thanks so much!!! squatto 1 Link to comment
Ben428 Posted February 14, 2020 Share Posted February 14, 2020 Thank you! I have wanted something like this for years to move 2FA codes from Messages into my VPN app. Works perfectly and I can do every step without taking my hands off the keyboard. LOVE IT. I don't know if this is possible or if anyone wants it besides me, but I have been using SMS to Google Voice for some 2FA notifications (since SMS to a SIM card is not really secure. etc.) and it would be even more awesome if there was a variant that could extract a 2FA code from Google Voice running in a browser window. Link to comment
deanishe Posted February 14, 2020 Share Posted February 14, 2020 (edited) 19 minutes ago, Ben428 said: a variant that could extract a 2FA code from Google Voice running in a browser window FWIW, that's not so much a variant as a completely different thing altogether. Edited February 14, 2020 by deanishe Link to comment
squatto Posted June 16, 2020 Author Share Posted June 16, 2020 (edited) I just released version 1.2.1 of the workflow, which fixes a bug that prevented codes from being found if they were followed by a period: "your code is 12345." Thanks to @tmm for the bug report and @manonstreet for submitting the fix! Latest release: https://github.com/squatto/alfred-imessage-2fa/releases/download/v1.2.1/iMessage.2FA.alfredworkflow Edited June 16, 2020 by squatto Make the link...a link Link to comment
squatto Posted July 3, 2020 Author Share Posted July 3, 2020 I just released version 1.2.2 of the workflow, which changes the input method from a system paste to simulated keystrokes. This fixes an issue with websites that monitor keystrokes and don't consider pasting to be a valid input (e.g. Wells Fargo online banking) Thanks to @cmer for submitting the changes! Latest release: https://github.com/squatto/alfred-imessage-2fa/releases/download/v1.2.2/iMessage.2FA.alfredworkflow Link to comment
squatto Posted November 17, 2020 Author Share Posted November 17, 2020 I just released version 1.2.3 of the workflow, which adds support for 4 digit codes (e.g. Airbnb) and 6 digit codes in the format `XXX-XXX` (e.g. Stripe). Thanks to @615don for submitting the suggestion! Latest release: https://github.com/squatto/alfred-imessage-2fa/releases/download/v1.2.3/iMessage.2FA.alfredworkflow Ben428 1 Link to comment
Aeraegon Posted November 24, 2020 Share Posted November 24, 2020 I'm getting this error message: Quote ERROR: Unable to Access Your Messages Link to comment
Richard N Tran Posted November 26, 2020 Share Posted November 26, 2020 Hi, I run into the same issue. Please help! 😃 Link to comment
Richard N Tran Posted November 26, 2020 Share Posted November 26, 2020 On 11/23/2020 at 7:43 PM, Aeraegon said: I'm getting this error message: I figured it out. You need go enable "Full disk access" to fix this. Everything works great now. JJJJ and squatto 2 Link to comment
squatto Posted February 10, 2021 Author Share Posted February 10, 2021 I just released version 1.2.4 of the workflow, which adds support for more code patterns and adds detection for codes in messages with extended characters. Thanks to @caidwang for letting me know about the issue! Latest release: https://github.com/squatto/alfred-imessage-2fa/releases/download/v1.2.4/iMessage.2FA.alfredworkflow Link to comment
squatto Posted February 11, 2021 Author Share Posted February 11, 2021 I just released version 1.2.5 of the workflow, which has the following changes: 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 Thanks to @luckman212 for the suggestion 👍🏻 Latest release: https://github.com/squatto/alfred-imessage-2fa/releases/download/v1.2.5/iMessage.2FA.alfredworkflow luckman212 and Ben428 2 Link to comment
squatto Posted May 26, 2021 Author Share Posted May 26, 2021 (edited) I just released version 1.2.6 of the workflow, which has the following changes: Match 3 and 4 digit codes if they immediately follow "code" or "is" (e.g. "your code is 1234", "enter code 573 to log in") Thanks to @luckman212 for the PR! Download the latest release: https://github.com/squatto/alfred-imessage-2fa/releases/download/v1.2.6/iMessage.2FA.alfredworkflow Edited November 5, 2021 by squatto luckman212, forgetfulfellow and deanishe 3 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now