laardee / serverless-authentication-boilerplate

Generic authentication boilerplate for Serverless framework
http://laardee.github.io/serverless-authentication-gh-pages
MIT License
568 stars 71 forks source link

How to deal with CORS issues? #23

Closed ChenLi0830 closed 7 years ago

ChenLi0830 commented 7 years ago

First of all, I know this is a general question of me rather than a real issue. The only reason I post here is I have a hard time finding a clear explanation on this. I am trying to call the signIn method of this repository from my site by making "get" ajax call. However, I get the following error.

XMLHttpRequest cannot load https://9yh8kzx6b1.execute-api.us-east-
1.amazonaws.com/dev/authentication/signin/facebook. Redirect from 'https://9yh8kzx6b1.execute-
api.us-east-1.amazonaws.com/dev/authentication/signin/facebook' to 
'https://www.facebook.com/dialog/oauth?client_id=954130508021993&redirect_ur…
6cbad6184f6e45c5e50fe412d34593e8a896838dae54a4e3a3bc2270a6da647e991ded3539' has 
been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested 
resource. Origin 'http://mydomain.com' is therefore not allowed access.

Is there something I did wrong? I am not quite sure which part of the sign in process lacks the 'Access-Control-Allow-Origin' header. Is it my site (hosted on S3)? Is it the API gateway?

ChenLi0830 commented 7 years ago

Found the usage example in https://github.com/laardee/serverless-authentication-gh-pages