Git Product home page Git Product logo

react-native-login's Introduction

react-native-login

What is it?

react-native-login is 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-cookies Once 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 ./ReactNativeLogin/App/components/App.js

What else?

An example server, using Express and Passport is included within this project under the ./server folder. You can use any server though, just be sure to change cookie.remember_me to whatever the name for your persistent cookie is, within the ./ReactNativeLogin/App/components/App.js file. Follow the installation instructions to learn more.

Be sure to also change the URLs in App.js to 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 ๐Ÿ˜„ YAY!

Requirements

Ensure that you have installed absolutely everything listed here

Installation

  1. git clone https://github.com/ryanmcdermott/react-native-login.git
  2. cd react-native-login/ReactNativeLogin
  3. npm install
  4. cd ../server
  5. npm install
  6. node server.js
  7. To run the iOS version, open another terminal window type open ../ReactNativeLogin/iOS/ReactNativeLogin.xcodeproj
  8. Click the play icon in Xcode to start the app

Contributing

Pull requests are much appreciated and accepted.

License

Released under the MIT License

Credits

Jared Hanson's excellent passport-remember me example

react-native-login's People

Contributors

ryanmcdermott avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.