flowbiz / Flowbiz

Flowbiz is a platform for developing and managing development projects using outsource services
0 stars 0 forks source link

Cross-Domain Authentication between pablo and henrietta #3

Open yatuvy opened 2 years ago

yatuvy commented 2 years ago

The pablo application is a Gatsby React server that serves as the Landing page for Flowbiz: https://home.flowbiz.info/DDSFTYl3od0rreqB Note that it uses the 'home.flowbiz.info' which is a subdomain of 'flowbiz.info'

The henrietta application is a React application that serves as the logic application of Flowbiz: https://flowbiz.info

Both applications have a SignIn/SignOut methods that are implemented by the same Firebase Authentication service.

The requirement is that if a user signs-in in one application (pablo or henrietta), then he should be automatically signed-in in the other application (henrietta or pablo) and the same should apply also for signing out - if the users signs out in one application he should be signed out in the other application and vise versa.

See:

  1. https://dev.to/johncarroll/how-to-share-firebase-authentication-across-subdomains-1ka8
  2. https://dev.to/brianburton/cross-domain-firebase-authentication-a-simple-approach-337k
yatuvy commented 2 years ago

The blogs suggest to use Firebase Functions in order to support these methods: users-signin , users-checkAuthStatus , users-signout

However, if the use of Firebase Functions es merely just a server side service and the same logic can be done in any other server side service, so it's better that we put this logic in our server side service (I.E. FlogoServerSimulator) and not in firebase functions

yatuvy commented 2 years ago

Authentication is implemented with Firebase Authentication service. In both applications, we import the getAuth,signInWithPopup,signOut methods from "firebase/auth" and use them for the authentication as described here