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
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…