Please excuse our look. We're just getting started here.Want to learn more about Twilio Forums? Check out our FAQ page here.
Error: Twilio.Exceptions.AuthenticationException: 'Username can not be null'
Hello everyone! I'm trying to use Twilio for an app that I'm working on, but I'm getting an error "Twilio.Exceptions.AuthenticationException: 'Username can not be null'". I'm using C# ASP.NET and Xamarin. Here's the part of the code:
// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
string accountSid = Environment.GetEnvironmentVariable("************"); (obviously I'll censor some sensible information)
string authToken = Environment.GetEnvironmentVariable("************");
string mensagem = "******";
string numeroTelefone = "+55" + DataEntry.Text;
var message = MessageResource.Create(
from: new Twilio.Types.PhoneNumber("********"),
to: new Twilio.Types.PhoneNumber(numeroTelefone)
do you guys have any ideas what may be causing the error? do I need to settle my Twilio username and password in the code, or just ID and authToken should work? Thanks if you took your time to answer me!
EDIT: Solved. I was trying to use my ID as an environment variable but forgot to set it first.
- 83 All Categories
- 19 SIGNAL 2021
- 376 Product Discussions
- 7 Community - Announcements
- 2 Changelog
- 4 Forum UI Updates
- 8 Welcome Guide
- 6 Community - Events
- 2 Twilio Relay Developer Conference 2021 Mega Thread
- 1 External Community Events
- 25 Inspiration
- 17 Community - Other Discussions
- 1 Community- Twilio Startups