Skip to content

Implement Authentication Flow with React Navigation and AsyncStorage#5

Open
cscouto wants to merge 1 commit intoExperient-Group:mainfrom
cscouto:login-flow
Open

Implement Authentication Flow with React Navigation and AsyncStorage#5
cscouto wants to merge 1 commit intoExperient-Group:mainfrom
cscouto:login-flow

Conversation

@cscouto
Copy link

@cscouto cscouto commented Feb 2, 2026

This PR implements the full authentication flow for the Experient React Native take-home assignment. Users can log in, persist their session, and access the main app. The solution follows the assignment requirements precisely and removes leftover Expo Router configuration.

Changes Included:

  1. Authentication Flow:
  • Login screen with Username, Password, and Login button.
  • On login, simulates API request to /auth/login using the provided mock payload.
  • Parses simulated Set-Cookie headers into accessToken and refreshToken.
  • Session persistence using AsyncStorage with token expiry handling.
  • Conditional rendering of the app based on authentication state.
  1. Navigation:
  • Added React Navigation with two stacks:
  • AuthStack → Login screen
  • AppStack → Home screen
  • Auth state controls which stack is displayed.
  • State Management:
  • Used React Context + useReducer to manage authentication state.
  • Handles login, logout, and session restoration on app launch.
  1. Storage:
  • Persisted accessToken, refreshToken, and tokenExpiry in AsyncStorage.
  • Session is restored if tokens exist and are not expired.
  1. Project Cleanup:
  • Removed Expo Router and all related configurations.
  • Deleted app/ folder to prevent route conflicts.
  • Updated package.json main entry to "node_modules/expo/AppEntry.js".
  • Updated app.json to remove web.output: "static" which was causing Expo Router errors.
  • Ensured App.tsx is the root entry point for React Navigation.
  1. Screens:
  • LoginScreen → Handles login and validation.
  • HomeScreen → Placeholder main screen with logout button.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant