Check out AuthCompanion, a passwordless login implementation for ideas. https://github.com/authcompanion/authcompanion2
The code is pretty simple and a good place to start, as well as AuthCompation, if you wanted to roll your own library in your language of choice or whatever, or something very custom. I found both useful recently.