How to use the Nuxt Session Cookie feature? #1527
              
                Unanswered
              
          
                  
                    
                      BenJackGill
                    
                  
                
                  asked this question in
                Questions and Help
              
            Replies: 2 comments
-
| I ended up needing to add the  | 
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            -
| And to actually use the session cookie in my code I did the following... This was inspired by these discussions: 
 And this PR: #1423 
 | 
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am using VueFire with Nuxt. I have some pages that anyone can access (login, sign, password reset, etc) and also some pages only users with an account should access (dashboard, settings, etc).
So as per the VueFire Nuxt docs it says I need to turn on the Session Cookie feature to persist the auth between page refreshes.
This needs to be done by:
sessionCookie: truetonuxt.config.ts(complete)But even after doing all of this I still get this console error:
FirebaseError: Firebase: Error (auth/requests-to-this-api-securetoken.googleapis.com-method-google.identity.securetoken.v1.securetoken.granttoken-are-blocked.).Any ideas what I'm doing wrong?
UPDATE:
I got rid of that console error. I had a restricted Firebase Browser API Key. So I had to add securetoken.googleapis.com (Secure Token API) to that list of allowed APIs, then the console error went away.
But now I have another problem...
App Check with Session Cookie throws an error. It works fine when I remove
sessionCookie: trueso this error is definitely related to Session Cookie.I think the problem stems from the fact the server is trying to do an App Check but the debug token I am using is in the browser not the server. Here is the error I am seeing on screen (not in the console) when
sessionCookie: trueis enabled:Also if the Firebase Browser Key has a website restriction (
http://localhost:3000andhttp://localhost:3000) I get this error on the screen (not in the console). Again, I think it's because the request is coming from the server and not the browser:This is my
runtimeConfigandvuefireconfig objects innuxt.config.ts:Beta Was this translation helpful? Give feedback.
All reactions