# Issue requesting Access Token with .NET SDK

**URL:** <https://community.auth0.com/t/issue-requesting-access-token-with-net-sdk/71450>\
**Category:** Get Help\
**Tags:** jwt, api, aspnet-core, management-api\
**Created:** [October 17, 2021, 6:34am UTC](https://community.auth0.com/t/issue-requesting-access-token-with-net-sdk/71450 "2021-10-17T06:34:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![adavisson](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/adavisson/32/12951_2.png) [@adavisson](https://community.auth0.com/u/adavisson)\
**Post date:** [October 17, 2021, 6:34am UTC](https://community.auth0.com/t/issue-requesting-access-token-with-net-sdk/71450/1 "2021-10-17T06:34:00Z")

</div>

Hi all,

Some info about my setup first. Working with a Blazor server-side application, running [asp.net](http://asp.net) core 5.0, with latest version of the Auth0 SDK installed. What I am running into and having problems with is requesting an access token to use with the management API.

Current code:

```auto
 string auth0Domain = "https://dev-qoess5ks.us.auth0.com/";
            var auth0AuthenticationClient = new AuthenticationApiClient(
                new Uri(String.Format("https://{0}", auth0Domain)));
            
            var tokenRequest = new ClientCredentialsTokenRequest()
            {
                ClientId = "myID",
                ClientSecret = "mySecret",
                Audience = String.Format("https://{0}/api/v2/", auth0Domain),
            };
            var tokenResponse =
                await auth0AuthenticationClient.GetTokenAsync(tokenRequest); // this is where my application times out, not sure if it means incorrect credentials or what.

            return tokenResponse.AccessToken;
        }

```

Just to check, I am inputting the ClientID and ClientSecret of the ManagementAPI correct? Not that of my current application? I have tried both and come to no avail.

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![Ale](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ale/32/50860_2.png) [@Ale](https://community.auth0.com/u/Ale)\
**Post date:** [October 18, 2021, 1:24am UTC](https://community.auth0.com/t/issue-requesting-access-token-with-net-sdk/71450/2 "2021-10-18T01:24:18Z")

</div>

Hey @adavisson, welcome to the Auth0 Community!

After taking a quick look it seems you included all the mandatory parameters as documented on our [Authentication API documentation](https://auth0.com/docs/api/authentication#client-credentials-flow). The question now is: Are they correct? Well, you asked about ClientID and ClientSecret. Those two must belong to the Machine to Machine application that you should have previously created; the M2M application that will be allowed to request Management API Access Tokens. More about this at the very bottom of my response.

You mentioned that your application timed out at some point. If you’d make a similar call via cURL you should be able to determine if the timeout comes from misuse or misconfiguration of your tech stack or maybe you’ll find out that there’s a network issue affecting cURL as well.

My suggestion would be to try to reproduce the issue via cURL. To do this, I encourage you follow our documentation on how to [Get Management API Access Tokens for Production](https://auth0.com/docs/security/tokens/access-tokens/get-management-api-access-tokens-for-production).

I hope this helps.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [November 2, 2021, 1:25am UTC](https://community.auth0.com/t/issue-requesting-access-token-with-net-sdk/71450/3 "2021-11-02T01:25:11Z")

</div>

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