How to use client_credentials for access users api

We need to create, deactivate and delete users in okta programatically and we are planning to use okta users api. Now we are not having the access to the apikey. Instead we are having client_credentials (client_id, client_secret). Please suggest how can we use client_credentials to get access users api.
We need to use oauth instead of apikey. Please suggest process.

You need to get an access token and then use it in your requests instead of SSWS ap_token (the header will be Authorization: Bearer access_token

Ok, but how exactly can we get access token. I mean which API call to be used exactly which takes client credentials and returns access token. Please suggest! this is the endpoint you need. You submit your credentials through the header and get the token back

Many thanks Philipp! We will try it and post the results soon.

We tried it however we are facing challenges as we are not able to get the request correctly.

Request :

Header : Accept:application/json, Authorization:Basic
Body : { grant_type:client_credentials, client_id:0oauq08tf2LifQvoi4x6, client_secret:<client_secret> }

Status : 400 (Bad request),
Body : {“errorCode”:“invalid_client”,“errorSummary”:“Invalid value for ‘client_id’ parameter.”,“errorLink”:“invalid_client”,“errorId”:“oaeu9-mG758TjiTPlfXDdlZ6Q”,“errorCauses”:[]},

What type of application are you using and is Client Credentials grant type allowed for it? This OAuth flow is only an option for Web and Service apps.

Something else I see that will be problematic with your request is that I don’t see you requesting any scopes for this token. In order to call Okta endpoints, the token must be granted the associated scope(s); for creating, deactivating, and deleting users, this will be the okta.users.manage scope.

Additionally, if you are looking to use a Service application to request tokens and use them to access Okta APIs, you will need to follow the steps in the following guide to create your application: Implement OAuth for Okta with a Service App