prescottprue/cypress-firebase

Save JWT in cookie after login

buesing opened this issue · 1 comments

The way my app's authentication is set up is that I listen for auth.onIdTokenChanged, save that JWT in a cookie and then send it with every request, to be able to verify the token on the server already and then render authenticated pages on the server side. Now with the default cypress-firebase behaviour I'm not getting that cookie saved of course, so I can't test this aspect of the app.

Is there a way to manually extend the login() method so I can replicate what my app does and save the token in a cookie after login? Or any other method I haven't thought of? Thanks!

NVM, I just realized that this is pretty easy by creating a new custom action that calls cy.login() and then listens for onIdTokenChanged and sets the cookie there.