Auth0 Home Blog Docs

Unable to connect to .Net Management API

I’m hoping that I’m missing something simple here, but was hoping to get some help.

I’m attempting to connect to the management API like this:

        public async void GetUsers()
        {
            using (var managementApi = GetManagementApi())
            {
                var users = await managementApi.Users.GetUsersByEmailAsync("a-valid-email@example.com");
                Console.WriteLine(users);
            }
        }

        private ManagementApiClient GetManagementApi()
        {
            var authToken = GetManagementAuthToken();
            return new ManagementApiClient(authToken, new Uri($"https://{Domain}/api/v2/"));
        }

(I can provide my GetManagementAuthToken function if needed, but suffice it to say, I’m getting an auth token).

When I attempt to hit the GetUsersByEmailAsync function, I get the following error:

System.ObjectDisposedException: 'Cannot access a disposed object. Object name: 'System.Net.Http.HttpRequestMessage'.'

I’m using the ManagementApi at version 7.0.0. Please let me know if you need anything else.

So, as I was writing this, I noticed that 7.0.0 just came out recently. For my own curiosity, I downgraded to 6.5.6. That worked without issue.

It seems that there was a regression in the bump to 7.0.0.

1 Like

Thanks for letting others in community know!

I’ve created an issue on the github repo here: https://github.com/auth0/auth0.net/issues/366

2 Likes

Perfect! I will ping the repo maintainer then!

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