ESI c#


(Evelyne Obolensky) #1

i try to change my little PI -Application from WindowsForm(API-XML) to Windows UWP ESI

Now i have a small Problem with SSO:

I can Login,
Redirect want me to authorize my selected scopes (callback is a small HTTPListener)
i authorize and get a code

Now i try to Exchange this Code into an access-token:

> // Create Jsondata for body
> var gt = new grant(Token);
> var jsondata = JsonConvert.SerializeObject(gt);
> // new Webclient
> System.Net.WebClient wc = new System.Net.WebClient();
> // URI AUTHURL = “https://login.eveonline.com/oauth/
> Uri uri = new Uri(Konstanten.AUTHURL + “token”);
> // create Header Base64
> var authcode = ClientID + “:” + SecretKey;
> var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(authcode );
> var aheader = System.Convert.ToBase64String(plainTextBytes);
**> **
**> **
> wc.Headers.Add(HttpRequestHeader.ContentType, “application/json”);
> wc.Headers.Add(HttpRequestHeader.Authorization, “Basic” + aheader);
> // Post it
> var result = wc.UploadString(uri, jsondata);

It always get back on this step: The remote server returned an error: (401) Unauthorized.

Any hint to help me ?


(Blacksmoke16) #2

Part of the issue might be you need a space between Basic and your base64 encoded string.


(Evelyne Obolensky) #3

correct !
thanks for your hint!


(system) #4

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.