How can I add two-factor authentication (2FA) to my application?


Adam Covati


Our two-factor authentication (2FA) solution allows you to quickly add 2FA to your application with one simple API that utilizes carrier-grade voice and messaging to deliver peace of mind to your customers. 

Can I customize the message that goes with the code?

Yes! When you make an API call to send a code, the Message parameter lets you control the message and allows variables for your application name, the code, and the scope of the code.

Can I limit how the codes can be used?

Yes! Our 2FA is able to set a scope. For example, you can create a scope for login and also for admin access. This way you can protect both the login and other sensitive activities without risking token reuse.

How long does the 2FA implementation take?

You only need to add a few lines of code to your application to call out to Bandwidth. If you’re replacing a home-grown solution or another vendor, then this is an extremely quick swap out!

If you’re implementing 2FA for the first time, you'll just need to add another step to your flow between the user’s requested action (oftentimes the login form) and their destination. This extra step accepts the code you’ll be sending out. After validating the code through our verification endpoint, you can then send the user to their destination.

Looking for more details on how to integrate? Check out our blog post that gets into the technical details of a 2FA integration.

What number will the codes be sent from?

You can send 2FA codes from any Bandwidth number, including 10-digit local, toll-free, and short codes.

Does this solution include phone number validation?

Bandwidth's 2FA offering takes in a 2FA request and delivers it directly to our voice or messaging platform for processing – those sub-systems each have their own validation as appropriate for their services. Generally, we require an E.164 format, specifically North American Numbering Plan numbers.

Our system will expect a number to be presented without parentheses or dashes. For example, the number +1-508-769-6555 would be submitted as +15087696555.

Ready to get started with 2FA?

If you’re interested in adding this feature, please reach out to your Account Manager. Not sure who your Account Manager is? Please open a ticket with your Bandwidth Support Team or hit us up at (855) 864-7776!

Article is closed for comments.