Join us for SpringOne, Jan 24-26, and learn how teams are building modern apps.
Live is streaming live. Watch now.

Authentication

Authentication is supported via the CloudFoundry.UAA namespace. Below is some sample code showing how to obtain a bearer token from UAA.

private static AuthenticationContext refreshToken = null;

client = new CloudFoundryClient(new Uri("https://[URL TO PCF INSTANCE]"), new System.Threading.CancellationToken());

CloudCredentials credentials = new CloudCredentials();
credentials.User = "[USER NAME]";
credentials.Password = "[PASSWORD]";

try
{
    refreshToken = await client.Login(credentials);
    retVal = true;
}
catch (Exception ex)
{
    Console.WriteLine(ex.ToString());
}