Is there any way to keep a person authenticated with firebase across subdomains

后端 未结 4 1002
鱼传尺愫
鱼传尺愫 2021-01-12 05:14

I use firebase for authentication on my website and I want to keep the users auth session active across subdomains.

Unfortunately, firebase uses Local Storage to sto

4条回答
  •  说谎
    说谎 (楼主)
    2021-01-12 05:34

    I used NGINX to load diffrent web apps which want to share same firebase auth which works out of box in firebase if domain or sub domain is same.

    server {
    root /var/lib/jenkins/workspace/app/dist;
    index index.html index.htm index.nginx-debian.html;
    server_name app.com; # example
    
    location /app1 {
            alias /var/lib/jenkins/workspace/app1/dist;
            try_files $uri $uri/ =404;
    }
    
    location /app2 {
            alias /var/lib/jenkins/workspace/app2;
            try_files $uri $uri/ =404;
    } 
    
    location /static {
            alias /var/lib/jenkins/workspace/build/static;
            try_files $uri $uri/ =404;
    }
    
    location ~ /\.ht {
        deny all;
    }
    
    listen 80;
    listen [::]:80; 
    
    }
    

提交回复
热议问题