---
title: "How to Build Passwordless Auth With Twilio Verify in Go"
description: "The tutorial builds a passwordless authentication flow in Go that uses Twilio Verify to send and validate one-time passwords (OTPs) by SMS, avoiding the need for users to manage passwords. It defines a small net/http API with GET and POST handlers for \"/\" and \"/verify\": the first collects a mobile number and starts verification, while the second accepts the received code and displays the result. The setup covers Go 1.23 or later, module dependencies, dotenv configuration for the Twilio Account SID, Auth Token, and Verify Service SID, plus session handling for the phone number. The verification check calls Twilio's CreateVerificationCheck() and renders success or failure using templates; running go run main.go starts the server on port 8080 for testing."
---

# How to Build Passwordless Auth With Twilio Verify in Go

[Twilio](https://yomu.fyi/company/twilio) · Matthew Setter · Aug 19, 2026

**Type:** Tutorial

## Summary

The tutorial builds a passwordless authentication flow in Go that uses Twilio Verify to send and validate one-time passwords (OTPs) by SMS, avoiding the need for users to manage passwords. It defines a small net/http API with GET and POST handlers for "/" and "/verify": the first collects a mobile number and starts verification, while the second accepts the received code and displays the result. The setup covers Go 1.23 or later, module dependencies, dotenv configuration for the Twilio Account SID, Auth Token, and Verify Service SID, plus session handling for the phone number. The verification check calls Twilio's CreateVerificationCheck() and renders success or failure using templates; running go run main.go starts the server on port 8080 for testing.

## Context

Typing or generating a unique password for every new account or website is described as a hassle. The tutorial presents passwordless authentication as a way to simplify login while reducing password-related risks and friction.

## Approach / What changed

The application uses Go's net/http package, Twilio Verify, GoDotEnv, Gorilla sessions, and templates. Users submit a phone number to trigger an SMS OTP, then submit that code through a verification route; the server checks it with Twilio and renders the outcome.

## Takeaways

- The flow has four handlers: GET and POST for "/" to collect a phone number and send an OTP, plus GET and POST for "/verify" to accept and validate the code.
- The .env configuration requires TWILIO\_ACCOUNT\_SID, TWILIO\_AUTH\_TOKEN, and TWILIO\_VERIFY\_SERVICE\_SID; the tutorial also installs Twilio's Go helper library and Gorilla session packages.
- verifyOtpCode retrieves the phone number from the session and calls CreateVerificationCheck(); an approved response renders "Verification was successful," while other outcomes render failure.

**Tags:** [Authentication](https://yomu.fyi/topic/authentication), [Go](https://yomu.fyi/topic/go), [Twilio](https://yomu.fyi/topic/twilio)

- Source: [Twilio](https://www.twilio.com/en-us/blog/developers/tutorials/product/build-passwordless-auth-with-twilio-verify-go)
- Source URL: https://www.twilio.com/en-us/blog/developers/tutorials/product/build-passwordless-auth-with-twilio-verify-go
- Ingested by Yomu: 2026-09-09T13:35:03.196Z

[Read original post](https://www.twilio.com/en-us/blog/developers/tutorials/product/build-passwordless-auth-with-twilio-verify-go)
