# Authentication problem

**URL:** <https://discussions.flightaware.com/t/authentication-problem/30075>\
**Category:** AeroAPI\
**Created:** [January 8, 2018, 10:04am UTC](https://discussions.flightaware.com/t/authentication-problem/30075 "2018-01-08T10:04:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![YHKIT](https://sea1.discourse-cdn.com/flex019/user_avatar/discussions.flightaware.com/yhkit/32/124869_2.png) [@YHKIT](https://discussions.flightaware.com/u/YHKIT)\
**Post date:** [January 8, 2018, 10:04am UTC](https://discussions.flightaware.com/t/authentication-problem/30075/1 "2018-01-08T10:04:42Z")

</div>

I got the following error message when calling the API  
The HTTP request is unauthorized with client authentication scheme ‘Basic’. The authentication header received from the server was ‘Basic realm=“FlightXML2”’.

service.cs

```
[WebMethod]
public string TestMethod1()
{
    try
    {
        String strResult = "";

        FlightXML2SoapClient client = new FlightXML2SoapClient();
        client.ClientCredentials.UserName.UserName = "raymondlai";
        client.ClientCredentials.UserName.Password = "xxxxxxx";

        EnrouteStruct r = client.Enroute("KHOU", 5, "", 0);
        foreach (EnrouteFlightStruct e in r.enroute)
        {
            //Console.WriteLine(e.ident);
            strResult += e.ident + "\r\n";
        }

        //Console.WriteLine(client.Metar("KAUS"));
        strResult += client.Metar("KAUS");

        return strResult;
    }
    catch (Exception ex)
    {
        return "";
    }
}

```

Web.config

```
<system.serviceModel>
    <bindings>
        <basicHttpBinding>
          <binding name="FlightXML2Soap" >
            <security mode="Transport" >
              <transport clientCredentialType="Basic" />
            </security>
          </binding>
        </basicHttpBinding>
    </bindings>
    <client>
        <endpoint address="https://flightxml.flightaware.com/soap/FlightXML2/op"
            binding="basicHttpBinding" bindingConfiguration="FlightXML2Soap"
            contract="FlightXML2.FlightXML2Soap" name="FlightXML2Soap" />
    </client>
</system.serviceModel>

```

---

<div class="post-metadata">

**Author:** ![smashfxml](https://sea1.discourse-cdn.com/flex019/user_avatar/discussions.flightaware.com/smashfxml/32/115460_2.png) [@smashfxml](https://discussions.flightaware.com/u/smashfxml)\
**Post date:** [January 8, 2018, 10:25pm UTC](https://discussions.flightaware.com/t/authentication-problem/30075/2 "2018-01-08T22:25:32Z")

</div>

Can you confirm that you are using your API Key as your password and not your FlightAware account password?

---

<div class="post-metadata">

**Author:** ![YHKIT](https://sea1.discourse-cdn.com/flex019/user_avatar/discussions.flightaware.com/yhkit/32/124869_2.png) [@YHKIT](https://discussions.flightaware.com/u/YHKIT)\
**Post date:** [January 9, 2018, 12:47am UTC](https://discussions.flightaware.com/t/authentication-problem/30075/3 "2018-01-09T00:47:04Z")

</div>

Thousand thanks for your help.

typo in my API Key.

Problem solved.
