Firebase token method
Unanswered
Rohu posted this in #help-forum
RohuOP
Hi all, I have a use case here:
I'm using Nextjs13 and Firebase Auth for authentication. The desired outcome is that after the user sign in, Firebase will generate a idToken and will be stored in localStorage. This token will be used along with sending API request to my backend, and my backend will verify the user again with Firebase Auth. However, I just learned that the Firebase idToken will be expired in an hour after it's generated. So I need to use refreshToken method. I saw on some posts that storing the auth token as cookie. However, in Nextjs, cookie is only supported for server side components. And most of my layouts are client side. May I know what should be the best approach?
I'm using Nextjs13 and Firebase Auth for authentication. The desired outcome is that after the user sign in, Firebase will generate a idToken and will be stored in localStorage. This token will be used along with sending API request to my backend, and my backend will verify the user again with Firebase Auth. However, I just learned that the Firebase idToken will be expired in an hour after it's generated. So I need to use refreshToken method. I saw on some posts that storing the auth token as cookie. However, in Nextjs, cookie is only supported for server side components. And most of my layouts are client side. May I know what should be the best approach?