C# port of the PHP sample in the parent folder. Implements the same three-step TOTP setup flow against the Twilio Verify API:
/— enter a username, which creates a new TOTP factor on a random entity identity/challenge— scan the QR code in an authenticator app and submit the generated code to verify the factor/token— submit subsequent codes to create a challenge and confirm the factor still works
- .NET 9 SDK
- A Twilio account with a Verify Service. Get the Service SID from https://console.twilio.com/us1/develop/verify/services
cp .env.example .env
# fill in TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN, TWILIO_VERIFY_SERVICE_SID
dotnet run
Then open http://localhost:5000 (the actual URL is printed at startup).
Program.cs— loads.env, initializes the Twilio client, wires up sessions and Razor PagesPages/Index.*— username form and TOTP factor creationPages/Challenge.*— QR code display and factor verificationPages/Token.*— ongoing challenge creation and verificationwwwroot/css/styles.css— styling
The QR code is generated locally with QRCoder and inlined as a base64 PNG data URI.