This is the curl command I'm using which generates a Bearer Token. The command has the following variables: $url(base url), $cid(clientid) and $csec(client secret). I have used the echo command and checked if the variables have stored correct value. If I replace the variables with their stored value then I'm able to fetch the Bearer Token.
curl --request POST $url/oauth/token -d 'grant_type=client_credentials&client_id=$cid&client_secret=$csec'
I'm getting the following error when I run this command:
{"error":"unauthorized","error_description":"Bad credentials"}
I have tried using quotes and braces but still not getting any success. These are the commands I have tried. Please let me know of any alternate approach.
curl --request POST "$url"/oauth/token -d 'grant_type=client_credentials&client_id="$cid"&client_secret="$csec"' curl --request POST '"$url"'/oauth/token -d 'grant_type=client_credentials&client_id='"$cid"'&client_secret='"$csec"'' curl --request POST {$url}/oauth/token -d 'grant_type=client_credentials&client_id={$cid}&client_secret={$csec}'