0
votes

I am trying to use passport to authenticate with Facebook but it is returning an error:

XMLHttpRequest cannot load https://www.facebook.com/v2.2/dialog/oauth?response_type=code&redirect_uri=…%2Fapi%2Fauth%2Ffacebook%2Fcallback&scope=email&client_id=1504988306431596. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access.

How can I fix this?

1
I'm not sure what the solution is but the cause is that you are trying to access content from one domain from another domain. You should probably be redirecting the use to the Facebook page instead of loading that page into yours.Josh Marinacci
You need to do this in node.js not your html pageslebetman

1 Answers

0
votes

In my opinion the problem is that you have not set the app domain on the facebook API. Go to https://developers.facebook.com/apps/{your app ID}/settings/ and set "localhost" on the field "App domains" for it to work. Have you already done that?