auth0 / auth0-oidc-client-net

OIDC Client for .NET Desktop and Mobile applications
https://auth0.github.io/auth0-oidc-client-net/
Apache License 2.0
84 stars 49 forks source link

Add logging support to the client #223

Closed duraz0rz closed 1 year ago

duraz0rz commented 2 years ago

Describe the problem you'd like to have solved

We're trying to troubleshoot some issues with a customer's SSO and network environment and noticed that we can't get any in-depth logs from the Auth0 client itself. We can pass in a web view and log certain events, but we have no way to trace through what the Auth0 client (and the underling OIDC client) is doing and how exactly it's failing.

Describe the ideal solution

Right now, there's no way to log what's happening in a production environment. The Auth0 client has a bunch of Debug.WriteLine statements which are fine during local development, but there's nothing to help when the app is in production. It would be nice to be able to be able to trace through the Auth0 client via logs.

Also, the OIDC client supports logging via [Microsoft.Extensions.Logging]{https://docs.microsoft.com/en-us/dotnet/core/extensions/logging?tabs=command-line). A LoggerFactory instance is created when you create a new OidcClientOptions instance, which the client uses to get a logger to use. It would be nice to be able to get those logs, as well.

Alternatives and current work-arounds

None, really. Hope that everything works in production all hunky dory!

frederikprijck commented 2 years ago

Thanks. A bit late to reply here, sorry about that.

This looks like a reasonable request, but not something we can prioritize in the near future.

Happy to review and merge a PR if you could provide one.

frederikprijck commented 1 year ago

Hey @duraz0rz ,

I opened a PR to address this, can you please take a look and see if this would be what you had in mind and whether or not it allows you to achieve what you would want to achieve?

Thanks

duraz0rz commented 1 year ago

Yep, that looks like what I had in mind at the time. Unfortunately, I'm no longer at the company that was using this, so I can't get in and test it out.