title: How to integrate Firebaseui auth with Redux
body: <p>I've got a working auth configuration set up using firebaseui.  I have a private landing page that I'd like to redirect the user to, but I'm not sure how to pass the credentialed response into my redux store.</p>
  
  <p>I basically want to call the <code>handleClickLogin</code> method (currently hooked to a dummy button) of my Home component from my <code>signInSuccess</code> callback.  In other words I'm trying to <code>dispatch(login());</code> when I get a successfull signin, which in turn adds the flag to my redux store which I can then use to gate my private landing page.  Since firebase.js is not in the component tree, I don't have access to <code>dispatch</code> here, so how do I get the response hooked in to my store?</p>
  
  <p><strong>firebase.js</strong></p>
  
  <pre><code>const uiConfig = ({
    // signInSuccessUrl: '/',
    signInOptions: [
      firebase.auth.EmailAuthProvider.PROVIDER_ID,
      ],
      callbacks: {
          signInSuccess: (resp) =&gt; &lt;&lt;&lt;???&gt;&gt;&gt;,
      },
  });
  
  firebase.initializeApp(config);
  const ui = new firebaseui.auth.AuthUI(firebase.auth());
  
  export const startFirebaseUI = elementId =&gt; {
    ui.start(elementId, uiConfig);
  };
  
  </code></pre>
  
  <p><strong>Home.jsx</strong> (stripped down)</p>
  
  <pre><code>
  export class Home extends React.PureComponent {
    static propTypes = {
      dispatch: PropTypes.func.isRequired,
      user: PropTypes.object.isRequired,
    };
  
    componentDidMount = () =&gt; {
      startFirebaseUI('#firebaseui-auth-container');
    }
  
    handleClickLogin = () =&gt; {
      const { dispatch } = this.props;
  
      dispatch(login());
    };
  
    render() {
      const { user } = this.props;
  
      return (
        &lt;Background&gt;
          &lt;HomeContainer&gt;
            &lt;Button
              onClick={this.handleClickLogin}
            &gt;
              &lt;Text ml={2}&gt;Start&lt;/Text&gt;
            &lt;/Button&gt;
            &lt;div id="firebaseui-auth-container" /&gt;
          &lt;/HomeContainer&gt;
        &lt;/Background&gt;
      );
    }
  }
  
  function mapStateToProps(state) {
    return { user: state.user };
  }
  
  export default connect(mapStateToProps)(Home);
  
  
  </code></pre>