m nadeem
m nadeem

Reputation: 25

react app state management and auth flow with firebase redux

i have created an app in react and firebase for auth used react-redux-firebase to manage state of app . after login the system i can access user state and accordingly sign the user in. but my concern is the state doesn't expires or cleared if app not used for long time and remains until not logged out .i want to clear the state if not app not used after n days.

firebase token expires in 1 hour , so do i have to call firebase onauthstatechanged listener with every call for a token or keep a timer every 50-60 min to refresh the token?? i dont know which way to go with or is there any other better way ?? or any other better authentication flow for the app!

Upvotes: 0

Views: 222

Answers (1)

Doug Stevenson
Doug Stevenson

Reputation: 317828

The Firebase SDK automatically refreshes the user's auth token every hour. You don't have to write any code for that. You only need on onAuthStateChanged listener for the entire app - it will always stay in sync with the user's sign-in state, and you also write no additional code for that.

Upvotes: 1

Related Questions