How to handle facebook login with a subdomain?

Viewed 51

My application client side serve using aws cloudfront/s3. www.example.com

My server side is nodejs in ec2. api.example.com

I want to do login with facebook.

I set facebook to redirect after login to api.example.com/api/facebook/return.

Now when I on api.example.com/api/facebook/return I need to get back to my application www.example.com with the user loggedin.

How to do it?

  • I don't want to use lambda (lets say this is not the solution for me).
  • I can't access to the localStorage to store the token and the user - cause safari doesn't support Hub in access to another localStronge domain.
  • Can't use cookie because I have LoadBalancer and stateless servers.
  • I try to send a 10 seconds token to the client and return back to the server (confirm the token) and then back to the client (access token). but sometimes the computer is slow and I get expired.

I was thinking about one time token, but how to implement such a thing? or any other idea how to handle this?

0 Answers
Related