Next.js Discord

Discord Forum

Firebase auth + next-auth & getServerSideProps

Saint Bernard posted this in #help-forum
Open in Discord
Saint BernardOP
I am working on an app that already has next-auth integrated but it also relies on firebase for authentication (weird i know!), but basically triggers firebase auth methods in next-auth which then stores authenticated user's data in session which can be accessed in serverside props. this can be used to effeciciently protect routes, etc etc. Got a couple of questions about this approach though because I am not happy about it + i ran into some problems trying to implement token refresh(didnt work, gave up)

1. Is it safe to do this? would you advise against it?
2. How would you handle cases like refreshing the access token (since firebase atokens expire after an hour, remember next-auth authed user session must reflect updated token)

0 Replies