colinhacks / next-firebase-ssr

An Next.js example repo for building authenticated pages with Firebase Authentication, cookies, and getServerSideProps
https://vriad.com/essays/nextjs-firebase-authentication
424 stars 61 forks source link

Token duplication #6

Closed yevyevyev closed 3 years ago

yevyevyev commented 3 years ago

Hi, I've got again duplicated tokens, even with the recent fixes. Cannot attach steps to reproduce, but what I was doing is login in and out from time to time and then somehow I've got those duplicates. Attached screenshot for more clarity.

https://prnt.sc/vufsay

yevyevyev commented 3 years ago

Hmm, maybe it is because I have sign in flow from different parts of my application so I'm setting the cookie path explicitly as global, that should do the trick nookies.set(null, 'token', token, { path: '/' });

wRWebDev commented 3 years ago

Thanks, @tapkain - Adding a fixed path attribute to the cookie solved the issue of multiplying cookies for me too 🙌

colinhacks commented 3 years ago

If someone submits this change as a PR I'll accept it.

mimiqkz commented 3 years ago

Why is there an error like this to begin with ? Is that because of the nookies package?

colinhacks commented 3 years ago

Fixed by #11, thanks @tapkain @wRWebDev!

I've also fixed the blog post.