ESI CallbackURL

Hello

maybe someone could help ok so here is my problem along with a little history of how I get here.

ok so historically when sso and crest first came out I had a play with it and got it working so cool. I have decided to pick up where I left off a year or so ago, when crest got superseded with esi.

now to create a callback url being as I wanted and still want to use windows universal app, I like c# :slight_smile:. I used the following code which produced a id for the store app and I could place that in the callback url box when regeristing a app, this all worked fine.

public string CreateCallBackURL()
{
// Create a callback URL for posting on the eve app website when registering app
return WebAuthenticationBroker.GetCurrentApplicationCallbackUri().ToString();
}

the above return a url something like below although I have changed the numbers for all 9s

ms-app://s-9-99-9-9999999999-9999999999-9999999999-9999999999-9999999999-9999999999-9999999999/

the problem is I can no longer input such a string into the eve app management box when creating a new app as format is wrong, neither can I change the scope of my old app as the callbackurl is wrong, interestingly the old app will still work, I just cant updte the scopes.

so my opinions are ?

@ CCP why is the SSO WebAuthenticationBroker for windows format not a valid callback url anymore ?

thanks in advance
nubiarn

This should get you started for a UWP app. Just drop a button in any old XAML page and use this for the click action:

private async void Button_Click(object sender, RoutedEventArgs e)
        {
            //The authorization endpoint you want the client to direct to.
            string startURL = "https://login.eveonline.com/oauth/authorize/?response_type=code&redirect_uri=eveauthproto://callback/&client_id=f28287fc0cdf41b181ab8ca95c336755&state=uniquestate123";

            //Whatever you entered into your EVE Application panel for the endpoint.
            string endURL = "eveauthproto://callback/";

            System.Uri startURI = new System.Uri(startURL);
            System.Uri endURI = new System.Uri(endURL);

            string result;

            try
            {
                //This calls the SSO sign in screen
                var webAuthenticationResult =
                    await WebAuthenticationBroker.AuthenticateAsync(WebAuthenticationOptions.None,
                    startURI, endURI);

                //Handles the response.
                switch (webAuthenticationResult.ResponseStatus)
                {
                    case Windows.Security.Authentication.Web.WebAuthenticationStatus.Success:
                        // Successful authentication. 
                        result = webAuthenticationResult.ResponseData.ToString();
                        break;
                    case Windows.Security.Authentication.Web.WebAuthenticationStatus.ErrorHttp:
                        // HTTP error. 
                        result = webAuthenticationResult.ResponseErrorDetail.ToString();
                        break;
                    default:
                        // Other error.
                        result = webAuthenticationResult.ResponseData.ToString();
                        break;
                }
            }
            catch (Exception ex)
            {
                // Authentication failed. Handle parameter, SSL/TLS, and Network Unavailable errors here. 
                result = ex.Message;
            }


            //If successful you should get the something that has your callback url, the authorization code,
            // and the state code.  
            var dialog = new MessageDialog(result);
            await dialog.ShowAsync();
        }

From there you have to exchange the authorization code for the token, but you can probably handle it from this point. Let me know if this works or if you have any other issues.

1 Like

you sir are a complete hero :slight_smile: turns out all I needed to add was the endURI to the webauthbroker now it all works again.

it is interesting that the callback used to accept the ms-app:// format but I guess that doesn’t matter now.

thank you very much

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