Skip to content

Renszit/auth

Repository files navigation

Auth Example Expo

This project is an example of how to implement authentication, authorization, and session management in an Expo app.

Features

  • Authentication: Users can sign in to the app.
  • Authorization: Controls access to certain parts of the app based on user roles.
  • Session Management: Handles user sessions, including sign in and sign out.

Tech Stack

  • Expo: A framework and a platform for universal React applications.
  • React Native: A framework for building native apps using React.
  • React Hook Form: A library to create forms in React.
  • Axios: A promise-based HTTP client for the browser and node.js.
  • UUID: For the creation of RFC4122 UUIDs.
  • Expo Secure Store: A secure place to store sensitive data in an Expo app.

Implementation

  • The SessionProvider component uses the useStorageState hook to manage session state.
  • The useSession hook provides functions to sign in and sign out.
  • The HomeScreen component uses the useSession hook to sign out.
  • The CustomButton component is a reusable button component.

Getting Started

  1. Install the dependencies by running the following command in your terminal:
npm install
  1. Start the Expo development server by running the following command:
npx expo start
  1. Open the Expo app on your device and scan the QR code displayed in the terminal or in the Expo Dev Tools page that opens in your web browser.

For android:

npm run android

For ios:

npm run ios