Extracting the code for an Oauth 2 Call

I have successfully created a post call to pick up a token.

When I click the code snippet and put it my code, I am getting a

Access to XMLHttpRequest at ‘Https://test.company/auth/token’ from origin test’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

The javascript code snippet generated does not contain all things necessary.

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://testcompany.com/API/Auth/Token",
  "method": "POST",
  "headers": {
    "Content-Type": "application/x-www-form-urlencoded",
    "cache-control": "no-cache",
    "Postman-Token": "23423-12345ff"
  "data": {
    "grant_type": "client_credentials",
    "client_id": " 12345-abcdeftest",
    "client_secret": "2345-abcdefgh"

$.ajax(settings).done(function (response) {

The credentials have been changed from the working ones for this segment