2

I am trying to get token from https://login.microsoftonline.com it gives me error But If I use https://cors-anywhere.herokuapp.com/ its works but requirement is to call this function every 2 min from more than 10 different browser so it will throw error too many request

Let me know how can we solve the issue

enter image description here

function requestToken() {
  return $.ajax({
    async: true,
    crossOrigin: true,
    url:
      'https://login.microsoftonline.com/xxxx/oauth2/v2.0/token', 
    method: 'POST',
    headers: {
      'content-type': 'application/x-www-form-urlencoded',
      'Access-Control-Allow-Origin': 'https://login.microsoftonline.com/'
    },
    data: {
      grant_type: 'client_credentials',
      'client_id ': 'xxxx', //Provide your app id
      client_secret: 'xxx', //Provide your client secret genereated from your app
      'scope ': 'https://graph.microsoft.com/.default'
    }
  });
}
1
  • Any help will be appriciated
    – Milind
    Nov 25, 2019 at 13:04

1 Answer 1

1

https://github.com/Rob--W/cors-anywhere - Fork this repo, deploy it on heroku, then you can make like 13k requests per 5 minutes :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.