:iphone: An example React Native project for client login authentication
react-native-loginis an example React Native project showing how to use a WebView and react-native-cookies to login to your existing backend.
Using a server-side login template that you have already created, this project wraps it with a WebView and checks authentication status using
react-native-cookiesOnce authenticated, a LoggedIn component is rendered showing the user they are authenticated. Cookies are persisted via the WebView so any other component you use that calls
fetch()to retrieve AJAX data will also pass on this cookie!
Furthermore, upon opening the app after closing it, the user will stay signed in. When they touch the logout button, their cookies are cleared and they are subsequently redirected to the login component which lives in
An example server, using Express and Passport is included within this project under the
./serverfolder. You can use any server though, just be sure to change
cookie.remember_meto whatever the name for your persistent cookie is, within the
./ReactNativeLogin/App/components/App.jsfile. Follow the installation instructions to learn more.
Be sure to also change the URLs in
App.jsto reflect the URLs of your production and/or development server. For example, if you are running Android on Genymotion you will need to change this to the appropriate localhost IP address.
WORKS FOR ANDROID AND IOS :smile: YAY!
Ensure that you have installed absolutely everything listed here
git clone https://github.com/ryanmcdermott/react-native-login.git
Pull requests are much appreciated and accepted.
Released under the MIT License
Jared Hanson's excellent passport-remember me example