Auth Recipes

Auth recipes assume that you have passed the following config when creating your store:

const rrfConfig ={
userProfile:'users',// can be any string path}

Google Login

Here is an example of a component that shows a Google login button if the user is not logged in, and a welcome message if they are. The initial loading state is handled with a simple "Loading..." message:

In order for this to work, the promise must know the name of the location within redux that the state is being stored, which is the function of the firebaseStateName config option. By default the firebaseStateName parameter is 'firebase' to match the getting started guide. If you are storing your firebase state under a different place within redux (i.e. the name given to the firebaseStateReducer) such as 'firebaseState' you must pass that name as firebaseStateName in your config.

Custom Auth Ready Logic

If you want to write your own custom logic for the promise that actually confirms that auth is ready, you can pass a promise as the authIsReady config option.

List of Online Users (Presence)

Basic

Include the userProfile parameter in config when setting up store middleware:

const rrfConfig ={
userProfile:'users',// where profiles are stored in database
presence:'presence',// where list of online users is stored in database
sessions:'sessions'// where list of user sessions is stored in database (presence must be enabled)}reactReduxFirebase(fbConfig, rrfConfig)

Now when logging in through login method, user will be listed as online until they logout or end the session (close the tab or window).