Home > Mobile >  C# Login page from application console
C# Login page from application console

Time:09-15

Is there a way to open a web page from my console application?

I have to login to a page to be able to authenticate myself in my console application. (for reasons of honesty, the login is only granted to me via browser, I am under authentication with SSO)

Is this something that can be done?

CodePudding user response:

You can use IdentityModel.OidcClient, an OpenID certified library which provides an OIDC Client implementation for .NET applications.

For your scenario, take a look at this example: https://github.com/IdentityModel/IdentityModel.OidcClient/tree/main/clients/ConsoleClientWithBrowser

You basically create an http listener on the loopback address (127.0.0.1). You open the default system browser and show the login page your identity provider. After successful login the identity provider redirects to the URL path where your http listener is listening and sends the authorization code.

You have to configure your identity provider accordingly to support login from native client.

  • Related