A React Native + Expo mobile application that allows users to log in, store an authentication token securely, fetch protected location data from a backend API, and display valid locations as markers on an interactive map.
This project demonstrates mobile authentication, REST API integration, secure local token storage, and map-based location visualization using React Native Maps.
- User login screen with username and password validation
- JWT-based authentication flow
- Secure token storage using AsyncStorage
- Protected API request with Bearer token
- Interactive map using React Native Maps
- Dynamic location markers
- Marker callouts with formatted address details
- Loading and error states
- Invalid location filtering
- Expo Router navigation
- TypeScript-based React Native structure
- Android and iOS support through Expo
- React Native
- Expo
- TypeScript
- Expo Router
- React Native Maps
- AsyncStorage
- REST API
- JWT Authentication
- Fetch API
- Android / iOS
The login screen allows users to enter their username and password.
After successful authentication, the access token is saved locally using AsyncStorage and the user is redirected to the map screen.
The map screen retrieves the saved token, sends an authenticated request to the backend, fetches location data, filters invalid coordinates, and displays valid locations as markers on the map.
DevCombineMapApp/
├── app/
│ ├── index.tsx # Login screen
│ ├── MapScreen.tsx # Map screen with markers
│ └── _layout.tsx # Expo Router stack layout
├── constants/
│ └── Colors.ts
├── hooks/
│ ├── useColorScheme.ts
│ ├── useColorScheme.web.ts
│ └── useThemeColor.ts
├── app.json
├── package.json
├── tsconfig.json
└── README.mdClone the repository:
git clone https://github.com/Shahzadali062/DevCombineMapApp.git
cd DevCombineMapAppInstall dependencies:
npm installStart the Expo development server:
npm startRun on Android:
npm run androidRun on iOS:
npm run iosRun on web:
npm run web- User enters username and password.
- App sends a login request to the backend API.
- Backend returns an access token.
- Token is saved locally using AsyncStorage.
- User is redirected to the map screen.
- Map screen reads the saved token.
- App sends an authenticated request to fetch locations.
- Valid locations are displayed as map markers.
POST /loginExample request body:
{
"username": "user",
"password": "password"
}Expected response:
{
"access_token": "jwt_access_token",
"refresh_token": "jwt_refresh_token"
}GET /locationsRequired header:
Authorization: Bearer <access_token>Expected response:
[
{
"latitude": 37.7893,
"longitude": -122.4108,
"formattedAddress": "925 Bush St, San Francisco, CA"
}
]The app uses react-native-maps to display an interactive map.
Location data is filtered before rendering, so records with invalid coordinates such as 0, 0 are not displayed.
Each valid location is shown as a map marker.
When a user taps a marker, a callout displays the formatted address.
npm startStarts the Expo development server.
npm run androidRuns the app on an Android emulator or connected Android device.
npm run iosRuns the app on an iOS simulator or connected iOS device.
npm run webRuns the app in a web browser.
npm run lintRuns Expo linting.
npm testRuns Jest tests in watch mode.
This project can be used as a starter template for:
- React Native authentication apps
- JWT-based mobile login systems
- Map-based mobile applications
- Location marker visualization
- Protected REST API integration
- Expo Router mobile projects
- Android/iOS map apps
Before using this project in production:
- Move backend URLs into environment variables
- Do not hardcode local IP addresses in source code
- Keep API keys private
- Restrict Google Maps API keys from Google Cloud Console
- Use secure token handling for production authentication
- Add proper refresh-token handling and logout flow
- Add logout functionality
- Add refresh token support
- Move API base URL to environment variables
- Add map search and filtering
- Add user profile screen
- Add better UI design for login and map screens
- Add location clustering for large datasets
- Add offline/error retry handling
- Add Firebase or push notification support
Shahzad Ali
React Native Developer | Mobile App Developer | AI Researcher
- GitHub: https://github.com/Shahzadali062
- LinkedIn: https://www.linkedin.com/in/shahzad-ali-989706251
- Location: Bangkok, Thailand