We all know that security online is very important.
“Your Google verification code is 431973”
Oh, come on! I want to be secure, but how many times do I have to tell you: ‘It’s me Google!’. With security, you can’t have the cake and eat it at the same time… or can you? This is where Tasker Authentication Helper comes in!
Tasker Authentication Helper
I’m going to use Tasker Authentication Helper to get the code out of the text message, no matter what the text message is, then send it as a clipboard to other devices via Join? Sounds good? I think this should save me a lot of time, especially when used with the 2-step authentication systems. And while I’m at it, let’s make the project as universal as possible, so it would work with all verification messages!
If you are REALLY concerned about what devices you are sharing this clipboard with, you can limit the devices receiving the code to an active PC in Tasker.
I have to admit, that most often the simple profiles are the one that solves the annoying issues. Tasker Authentication Helper is very simple. It took me a while to fail miserably at regex. I have not been able to find a single regex formula, but the profile works well with 2 filters working together. If you are a PRO in regex, feel free to combine both formulas together and let me know!
I’m using AutoNotification (*but nothing should stop you from using a built-in Tasker’s SMS received condition – further modifications needs to be done to variables) to intercept the message. A simple filter of the %antext (pin|code) will assure that I don’t start assigning any values without a reason. Let’s not run a task if we don’t have to.
To fish out the code from a text message we are going to use 2 regex filters. This should prevent incorrect values from being assigned:
- a text with a number, but without pin or code word
- a text with a number that is not a pin or code
- a text with multiple numbers – capture the first match after code/pin
- a text with multiple numbers where the code/pin word is placed after the code
Please test the message, to make sure that your messages are being filtered accordingly.
Tasker Authentication Helper – regex
To capture the actual code, I’m going to use Regex. I have several different variations stored on my phone and I’m going to use it as an example. I tried to cover the biggest number of scenarios possible, but if your verification text falls outside of the scope of my regex filters – you will have to modify it to your needs.
Let’s start with capturing the numbers after the words pin/code (case insensitive) – I’m using www.regex101.com for this.
(code|pin).*?\d+
The result is good, but I failed with the last example. Our matches are:
code is 431973
code:895941
PIN is 4044
Using search/replace action I will store the matches in an array %code. Our match will be placed in the 1st element: %code1. The %code1 won’t be set if the verification text follows the last example. If that’s the case I can set another Regex filter:
^(.*?)\d+
Instead of building a very complicated Regex filter (and mostly because it’s a task way above my understanding of Regex) I will just filter the results again. In both circumstances the second filter will be the same:
\d+
The result of the second filter is stored in the %auth array as the first element %auth1. This variable is used to set a clipboard and shared with other devices with Join app.
Conclusion
Tasker Authentication Helper project works fast and speeds up the login in times. I think I’m getting too old to remember the short numbers, or simply too old to go and find my mobile each time I want to log in anywhere without compromising my security. I hope you will find this project useful. Share it with your friends and give it a like while you are here.
Project Download
Download project files here. Bear in mind that Patreon supporters have early access to project files and videos.