Requesting Access and Refresh Tokens - TypeError: Failed to fetch

Hello, I am having some difficulty requesting access and refresh tokens for my third party app. The app is a webpage, also built using Wix.

I am using fetch to request the tokens.

app_id, secret_key, and auth_code are defined earlier in the code, and I have been able to use them to successfully request tokens using the tool at this link: https://dev.wix.com/api/authorization#oauth.access-token-request

let options = {
    'method' : 'POST',
    'headers' : {
        'Content-Type': 'application/json'
    },
    'body' : {
        'grant_type' : 'authorization_code',
        'client_id' : app_id,
        'client_secret' : secret_key,
        'code' : auth_code
    }
}

fetch(url, options)
    .then( (httpResponse) => {
        if (httpResponse.ok) {
            return httpResponse.json();
        } else {
            return Promise.reject("Fetch did not succeed");
        }
    } )
        .then( (json) => console.log(json) )
            .catch(err => console.log("ERROR: " + err));

I am getting the following error:

"Access to fetch at 'https://www.wix.com/oauth/access' from origin 'https://www.stevewalsh.co' 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. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled."

ERROR: TypeError: Failed to fetch

Any ideas?

Update:

I was getting the CORS error because I was running it in the front-end.