0

I have firebase authentication set up and working fine for one app. However, I have two other apps that the first app redirects to depending on the user access level. For example, when a user signs into the first app, if they are a SuperAdmin then the app will allow that user to continue in the first app at admin.mydomain.com. If the user is a Manager then the app redirects the user to manager.mydomain.com. Finally if the user is an Employee the app will redirect the user to employee.mydomain.com.

The specific issue I am facing is that when the redirect happens the token that was generated for admin.mydomain.com is not set on either of the other two subdomains. Is there a way to persist the login credentials between applications?

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
Maninacan
  • 96
  • 9
  • If there's a crednetial object that can be used to cause firebase to "auth" using existing credentials, there are various ways you coudl copy that object to the other site. This might work for copying: https://stackoverflow.com/a/7722326 A more complex solution A firebase cloud function that writes to a collection (with no read/write access to clients) and issues a token that can be used to redeem the credential json or something maybe could keep thinks secure. You could pass the json in like a query parameter but that seems like it would have security issues. – csga5000 Sep 10 '22 at 16:38
  • This guy seems to have but his head against this issue already: https://dev.to/johncarroll/how-to-share-firebase-authentication-across-subdomains-1ka8#:~:text=If%20you%20use%20Firebase%20Authentication,in%20to%20each%20subdomain%20separately. – csga5000 Sep 10 '22 at 16:38

0 Answers0