Authentication Methods

Authentication data is attached to state.firebase.auth, profile is attached to state.firebase.profile if you provide a value to the userProfile config option. You can get them within components like so:

If you need access to methods that are not available at the top level, you can access Firebase's Full Auth API using props.firebase.auth() or getFirebase().auth().

NOTE

All examples below assume you have passed firebase from context to props. Wrapping your component with with the withFirebase or firebaseConnect Higher Order Components will make props.firebase available within your component:

The credential parameter is a firebase.auth.AuthCredential specific to the provider (i.e. firebase.auth.GoogleAuthProvider.credential(null, 'some accessToken')). For more details please view the Firebase API reference

custom token (runs ref.authWithCustomToken(credentials)). profile is required if automatic profile creation is enabled (which it is by default if you are using userProfile). config.updateProfileOnLogin config option can be set to false in order to prevent this behavior.

phone number (runs ref.signInWithPhoneNumber(phoneNumber, applicationVerifier)). Automatic profile creation is enabled by default if you are using the userProfile config option. updateProfileOnLogin config option can be set to false in order to prevent this behavior.

Examples

Parameters

Returns

signInWithPhoneNumber(code)

Signs in using a phone number in an async pattern (i.e. requires calling a second method). Calls Firebase's firebase.auth().signInWithPhoneNumber(). If there is an error, it is added into redux state under state.firebase.authError.