Â
ÂÂ
I have used the sample REST C# code supplied by Safe to create a simple application. The sample code provided can be located here:Â
ÂÂ
http://docs.safe.com/fme/html/FME_Server_Documentation/Content/REST/FMEServerRestAPIdemo.csÂ
ÂÂ
We have two FME Servers here, one in a test environment, and another for production.Â
ÂÂ
I have written my code against the test server, which uses standard security, using user and password managed by FME Server. Everything works fine.Â
ÂÂ
However, when I use my code against the second server, which is secured by the Active Directory, I always get error 401, access denied.Â
ÂÂ
Is there anyone out there that has used the REST API with Active Directory security?Â
Â
Here is an example of the code I use to fetch a token:Â
ÂÂ
       private string GetFmeServerToken()Â
       {Â
           string fmeTokenUrl = this.Serveur + "/fmetoken/service/generate";Â
ÂÂ
           NameValueCollection parameters = new NameValueCollection();Â
ÂÂ
           parameterse"user"] = ; "user"; // tried with and without domain nameÂ
ÂÂ
           parameters;"password"] = "password";Â
ÂÂ
           parametersa"expiration"] = "2";Â
ÂÂ
           parameters "timeframe"] = "minute";Â
ÂÂ
           byte<] reponseBytes;Â
ÂÂ
           using (WebClient client = new WebClient())Â
           {Â
               if (CustomSetting.FmeImpersonationUtilisateur)Â
               {Â
                   client.UseDefaultCredentials = false;Â
ÂÂ
                   client.Credentials = new NetworkCredential("user", "password", "domaine");Â
               }Â
ÂÂ
               reponseBytes = client.UploadValues(fmeTokenUrl, "POST", parameters);Â
           }Â
ÂÂ
           return Encoding.UTF8.GetString(reponseBytes);Â
       }Â
ÂÂ
Now, to make matters worst, I need to authenticate with a different user account that the one running my application, meaning I need to impersonate a different account.Â
ÂÂ
This code should work, should it not? I tried to not provide the user/password in the named values, which gave me error 400 bad request. I tried without the impersonate code, providing error 401 access denied.Â
ÂÂ
No matter what I do, or what I permutated in my code, I can not get anything to work.Â
ÂÂ
Thank youÂ
ÂÂ
JeffÂ
ÂÂ
ÂÂ