How to integrate with my React project?
jasan-s opened this issue · 5 comments
I'm going to build a react-native app , And a landing page using react along with it , how can I best integrate your code without copy pasting components into my landing page React app.
I’m assuming the landing page just has some marketing info pointing users to the react-native app and that the landing page will possibly be hosted using firebase hosting.
You will need to have more than one route. An IndexRoute for your landing page and a route to handle the urls that firebase will generate.
Your react-router routes would be something like this:
<Router history={browserHistory}>
<Route path="/" component={App}>
<IndexRoute component={Landing} />
<Route path="/action" component={Action} />
</Route>
</Router>
In the example app I created I only included the other routes and components so that I could trigger the situations where emails will be sent. In your case this will be your react-native app that will have a forgot password form, which will send an email.
@griffinsockwell , one more thing. Do I need any backend server side secure logic? For security, or all these routes handled in the client side with firebase hosting just perfectly fine?
You shouldn't need a server for this. Firebase will generate the emails for you and when you handle it on the client firebase will also verify that they were the ones that created the code.
For example if you look at the ResetPassword component when it mounts the first thing it does is call a function to make sure the code in the url is valid.
Yeah, Firebase Authentication provides you with a whole bunch functions that they will handle on the backend and you just need to set it up in your client code.