Auth0 Home Blog Docs

Swift: Validate email address before onAuthenticationBlock?



I’m using passwordless (“magic link”) login for an iOS app using A0Lock’s newEmailViewController. The act of logging in works fine by itself, but I’m running into an issue with validating the supplied email address before Auth0 emails the code.

I’d like to take the email supplied by the user in that ViewController, hand it to our backend, confirm that an account exists with that email, and then either continue or provide an error, depending on the response. The backend portion for this is finished, but I’m struggling to find a way to get the text input out of the viewcontroller.

I know that there’s the onAuthenticationBlock, which we use as our post-code callback. I’m asking if there’s a callback I can hook into that runs before the code is sent.


Hi Ian,

This is not something provided by Lock, to facilitate this kind of bespoke behaviour you could look at creating your own Custom UI although it’s a bit more work for magic links.

Passwordless has been released for Lock 2 as of 2.2 so I would recommend you take a look at that, you could look at modifying the Email Validator to hook into your API as one possible solution.