Custom login for WPF application?

,

Newbie here… I’m trying to implement a custom login screen for a WPF application.
The WPF workflow sample works fine except that it pops up its own window that I can’t change.

We have a highly stylized application (using irregular shaped windows and lots of custom widgets) so the pop-up window just wont cut it.

I tried using this code but it doesn’t work and I can’t find any samples for C# that just simply use email and password.

What I tried (with auth api 3.7):
try
{
var domain = new Uri(“https://[MY-AUTH0-DOMAIN]/authorize”);
var client = new AuthenticationApiClient(domain);
var req = new AuthenticationRequest();
req.Username = Email;
req.Password = Password;
req.ClientId = “[MY CLIENT ID]”;
req.Scope = “openid”;
req.Connection = “[MY CONNECTION NAME]”;

            var res = await client.AuthenticateAsync(req);
        }
        catch (Exception ex)
        {
            Debug.WriteLine(ex.Message);
            Environment.Exit(-1);
        }

This seems like such a basic workflow with just using id and password yet I can’t find any sample code.
The newest API doesn’t event seem to support AuthenticationRequest any longer. What am I missing?
Please help.

Chris

Got it to work with this code:

var domain = new Uri("[MY DOMAIN]");
var client = new RestClient(domain);

var request = new RestRequest("oauth/token", DataFormat.None);
request.Method = Method.POST;
request.AddParameter("grant_type", "password");
request.AddParameter("client_id", "[MY CLIENT ID]");
request.AddParameter("client_secret","[MYCLIENT SECRET]");
request.AddParameter("scope", "openid");
request.AddParameter("username", Email);
request.AddParameter("password", Password);

var result = await client.ExecuteAsync(request);

And key was to also do this:
https://www.youtube.com/watch?v=Qc2QAoVfjn0

1 Like

Glad you have it working and thanks for sharing with the rest of community!

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