0

I'm trying to generate OAuth2.0 token for bussiness central api in my react application and i got this error " Access to XMLHttpRequest at 'https://login.microsoftonline.com/7c885fa6-8571-4c76-9e28-8e51744cf57a/oauth2/v2.0/token' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. "

axios.post(https://login.microsoftonline.com/7c885fa6-8571-4c76-9e28-8e51744cf57a/oauth2/v2.0/token, {

  grant_type: 'client_credentials',

  client_id: clientId,

  resource: resource,

  client_secret: clientSecret,

  scope: scope

}).then((response) => {

  const accessToken = response.data.access_token;

  settoken(accessToken);

}).catch((error) => {

  console.error(error);

})

I run this code and got error in console

0 Answers0