Create new auth token using Oauth token URL to call API from react SPA throws CORS error


I have successfully logged into react SPA application using oauth and I am trying to generate a new auth token to make a API call - with an audience and scope different from that used as part of oauth authentication.

Is it possible to include multiple audiences and scopes (as an array) as part of authentication?

My SPA needs to make multiple API calls using different audiences and scopes.

I have tried below code to generate auth token but this throws CORS error.

Kindly advise.

var options = {
method: “POST”,
url: “https://XX/oauth/token”,
headers: {
“content-type”: “application/x-www-form-urlencoded”,
“Access-Control-Allow-Origin”: window.location.origin,
data: new URLSearchParams({
grant_type: “client_credentials”,
client_id: “XX”,
audience: “XX”,

    .then(function (response) {
    .catch(function (error) {