title: Twilio in Ionic Angular
body: <p>Novice Dev...</p>
  <p>I have an Ionic/Angular app with a form group for a person to input their details and when they Sign In I am trying to send an SMS via Twilio's API using POST.</p>
  <p>If I add the login details to the API url I receive the following error:
  Failed to execute 'fetch' on 'Window': Request cannot be constructed from a URL that includes credentials: https://XXX:XXX@api.twilio.com/2010-04-01/Accounts/XXX/Messages.json</p>
  <p>And If I add the credentials in the header I receive the below:
  POST <a href="https://api.twilio.com/2010-04-01/Accounts/XXX/Messages.json" rel="nofollow noreferrer">https://api.twilio.com/2010-04-01/Accounts/XXX/Messages.json</a> 401 (Unauthorized)</p>
  <p>I am not concerned about the key being hardcoded as this is an internal app but not sure how to successfully implement the SMS functionality.</p>
  <p>Below is my .ts code for the function.</p>
  <p>Any Suggestions?</p>
  <pre><code>  signIn(form){
    fetch('https://api.twilio.com/2010-04-01/Accounts/xxx/Messages.json',{
      method: 'POST',
      headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json',
        'Authorization': 'Basic ' + btoa('xxx:xxx'),
      },
      body: JSON.stringify({
        &quot;from&quot;: [&quot;+xxxxx&quot;],
        &quot;to&quot;: [&quot;+xxxxx&quot;],
        &quot;body&quot;: this.contractor.firstName + &quot; &quot; + this.contractor.lastName,
  
      })
    }).then(function(response) {
    return response.json();
    });
  </code></pre>