Read SMS token and save it to clipboard.
It saves me ton of time when connecting to various VPNs, filling SSO creds etc.
If any is a NO, it will not work for you.
- Have
go
installed (coz I'm not uploading binaries) - Be iPhone user
- Be Mac user
- SMS with token fits in one of these 2 templates:
- Token code: {TOKEN}
- Use verification code {TOKEN} for Microsoft authentication.
- Want more? Send me your SMS and we add it as template.
- Your terminal must have full disk access
- Why? To read messages database, which is in
~/Library/Messages
. - How to set it: System Settings ➡ Privacy & Security ➡ Full Disk Access
- Test it. This command shall return some SMS(s):
📟 make test-db
- Why? To read messages database, which is in
📟 make build
In repo root, run:
📟 make test-ride
# you get a message like:
:: token '435359' copied to clipboard (16 seconds old)
# or:
:: token is too old (31 minutes), try again
# 1. Install
📟 make install
# - creates shell script $REPO/bin/token
# - creates symlink $REPO/bin/token -> /usr/local/bin/token
# 2. Run it anywhere
📟 token
# 3. Uninstall
📟 make uninstall
# - this will delete symlink /usr/local/bin/token
Using sqlite3
CLI we read messages DB (synced between iOS+MacOS) and then parse message text + timestamp.
Newest message wins.