0

I'm trying to make an AJAX request to the Instagram API, but receive this error:

No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access.

This is because I am using http rather than https for my local environment. For production, I am using https.

This problem isn't just related to Instagram, this is a problem for any API that uses OAuth2, so how do people address this general issue?

anon
  • 2,143
  • 3
  • 25
  • 37

1 Answers1

0
  • Quick and dirty : Use https on localhost with a self signed certificate added to your browser certificate trust store
  • Better : use http on a domain you own ( like dev.example.com ) with a trusted certificate (from Let's encrypt for example) and change your DNS configuration to point dev.example.com to your local ip
Tom
  • 4,666
  • 2
  • 29
  • 48