# Auth0 with Console Application

**URL:** <https://community.auth0.com/t/auth0-with-console-application/175896>\
**Category:** Get Help\
**Tags:** configuration, application\
**Created:** [January 29, 2025, 9:19am UTC](https://community.auth0.com/t/auth0-with-console-application/175896 "2025-01-29T09:19:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![wyang](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/wyang/32/72099_2.png) [@wyang](https://community.auth0.com/u/wyang)\
**Post date:** [January 29, 2025, 9:19am UTC](https://community.auth0.com/t/auth0-with-console-application/175896/1 "2025-01-29T09:19:44Z")

</div>

Hi, I have issues with Auth0 login with console application.

I got WebViewBrowserChromium from one of the post.

When I try to call this web view form in Main Program.cs, I alwasy got the error  
Cannot change thread mode after it is set.

I think the issue is with WebViewForm2

Any idea? Thanks

---

<div class="post-metadata">

**Author:** ![dawid.matuszczyk](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dawid.matuszczyk/32/74550_2.png) [@dawid.matuszczyk](https://community.auth0.com/u/dawid.matuszczyk)\
**Post date:** [January 29, 2025, 11:31am UTC](https://community.auth0.com/t/auth0-with-console-application/175896/2 "2025-01-29T11:31:28Z")

</div>

Hi @wyang

Welcome to the Auth0 Community!

Can you share more details regarding your use case, which SDK you are using, and share the exact error?

Thanks!  
Dawid

---

<div class="post-metadata">

**Author:** ![wyang](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/wyang/32/72099_2.png) [@wyang](https://community.auth0.com/u/wyang)\
**Post date:** [January 30, 2025, 10:31am UTC](https://community.auth0.com/t/auth0-with-console-application/175896/3 "2025-01-30T10:31:51Z")

</div>

Basically, it will have error in

```
    var loginResult = await auth0Client.LoginAsync(extraParameters: extraParameters);

```

The error is  
System.Runtime.InteropServices.COMException: ‘Cannot change thread mode after it is set. (Exception from HRESULT: 0x80010106 (RPC\_E\_CHANGED\_MODE))’

---

<div class="post-metadata">

**Author:** ![wyang](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/wyang/32/72099_2.png) [@wyang](https://community.auth0.com/u/wyang)\
**Post date:** [January 30, 2025, 10:31am UTC](https://community.auth0.com/t/auth0-with-console-application/175896/4 "2025-01-30T10:31:52Z")

</div>

I’m try to post a screenshot, but I cannot.

Always get the error:

An error occurred: Sorry, you can’t embed media items in a post.

---

<div class="post-metadata">

**Author:** ![wyang](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/wyang/32/72099_2.png) [@wyang](https://community.auth0.com/u/wyang)\
**Post date:** [January 30, 2025, 10:32am UTC](https://community.auth0.com/t/auth0-with-console-application/175896/5 "2025-01-30T10:32:03Z")

</div>

I try to make it simple, Create a new .net Framework4.7.2 Windows Form Application.

Add the all the required reference.

Adding the code like this in Program.cs file. When you run it, you will see the error.

[STAThread]  
static async Task Main()  
{  
Application.EnableVisualStyles();  
Application.SetCompatibleTextRenderingDefault(false);

```
        var options = new Auth0ClientOptions
        {
            Domain = {Domain},
            ClientId = {Client Id},
            Scope = "openid profile refresh",
            RedirectUri = {RedirectUri},
            PostLogoutRedirectUri = {PostLogoutRedirectUri}

        };

        var auth0Client = new Auth0Client(options);

        var extraParameters = new Dictionary<string, string>
            {
                { "connection", "Username-Password-Authentication" },
                { "audience", {audience} }
            };
        var loginResult = await auth0Client.LoginAsync(extraParameters: extraParameters);

        if (loginResult.IsError)
        {
            //Log(loginResult.Error + "\r\n" + loginResult.ErrorDescription, "Login response");
            throw new Exception(loginResult.ErrorDescription);

        }

        Application.Run(new Form1());
    }

```
