Using the cURL Command

You can use cURL to generate a token using the following shell script:

RESPONSE=$(curl --location --request \
POST "https://<idcs authorization server host>/oauth2/v1/token" \
--header "Content-Type: application/x-www-form-urlencoded" \
--header "Authorization: Basic ${ENCODED_CREDS}" \
--data-urlencode "grant_type=client_credentials" \
--data-urlencode "scope=urn:opc:idm:  myscopes")
ACCESS_TOKEN=$(echo ${RESPONSE} | jq -r .access_token) 
echo ${ACCESS_TOKEN}