# How do I add a grant type when creating a client (.net core 2.0)?

**URL:** <https://community.auth0.com/t/how-do-i-add-a-grant-type-when-creating-a-client-net-core-2-0/8523>\
**Category:** Get Help\
**Tags:** net-core, grant-types\
**Created:** [October 19, 2017, 1:18pm UTC](https://community.auth0.com/t/how-do-i-add-a-grant-type-when-creating-a-client-net-core-2-0/8523 "2017-10-19T13:18:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark\_Redman](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mark_redman/32/6240_2.png) [@Mark\_Redman](https://community.auth0.com/u/Mark_Redman)\
**Post date:** [October 19, 2017, 1:18pm UTC](https://community.auth0.com/t/how-do-i-add-a-grant-type-when-creating-a-client-net-core-2-0/8523/1 "2017-10-19T13:18:53Z")

</div>

I am adding non-interactive clients of API access and looks like I need to add the client\_credentials grant type. How do I add this via the ManagementApi using the .net core library.

I am using the following code to create the non interactive client then creating a grant to authorise it with an API, not sure where the grant types are specified, i.e. on the client or via adding a grant?

```
var client = GetClient(scopes);

                var clientCreateRequest = new ClientCreateRequest
                {
                    Callbacks = new] {_auth0Settings.CallbackUrl},
                    IsFirstParty = false,
                    ClientMetaData = new {tenantId},
                    ApplicationType = ClientApplicationType.NonInteractive,
                    Name = name
                };

                var nonInteractiveClient = await client.Clients.CreateAsync(clientCreateRequest);

                var newClientGrantRequest = new ClientGrantCreateRequest
                {
                    ClientId = nonInteractiveClient.ClientId,
                    Audience = _auth0Settings.ApiIdentifier,
                    Scope = new List<string> { }
                };

                var newClientGrantResponse = await client.ClientGrants.CreateAsync(newClientGrantRequest);

```

**UPDATE:**

Creating a non-interactive client manually sets default grant types, creating a non-interactive client via the API, one would expect the same defaults if created via the API?

Also if a non-interactive client is created via the API the grant types cannot be adjusted via the admin interface and not all the grant types are there (I don’t really want to select them there if I am creating them via the API but would be good to see them for consistency and sanity check)

Its seems form this post: [Has Create Client management API behaviour changed re. grant types? - Auth0 Community](http://community.auth0.com/questions/3938/has-create-client-management-api-behaviour-changed)

we need to set :

```
clientCreateRequest.TokenEndpointAuthMethod = TokenEndpointAuthMethod.ClientSecretPost;

```

I will try it and see

Where is all this stuff in the documentation? …cries with frustration..

---

<div class="post-metadata">

**Author:** ![Mark\_Redman](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mark_redman/32/6240_2.png) [@Mark\_Redman](https://community.auth0.com/u/Mark_Redman)\
**Post date:** [October 19, 2017, 4:02pm UTC](https://community.auth0.com/t/how-do-i-add-a-grant-type-when-creating-a-client-net-core-2-0/8523/2 "2017-10-19T16:02:59Z")

</div>

As per my original post update:

when creating a client this setting is required to ensure that the client\_credentials grant type is enabled

```
TokenEndpointAuthMethod = TokenEndpointAuthMethod.ClientSecretPost;

```

---

<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:** [March 2, 2018, 5:57am UTC](https://community.auth0.com/t/how-do-i-add-a-grant-type-when-creating-a-client-net-core-2-0/8523/3 "2018-03-02T05:57:02Z")

</div>


