A production-ready React Native mobile application that integrates with Moodle Learning Management System (LMS) to provide seamless passkey authentication and access to course content through a native mobile interface.
Traditional mobile access to Moodle requires users to:
- Navigate through complex web interfaces designed for desktop
- Manually enter credentials repeatedly
- Deal with inconsistent mobile web experiences
- Lose context when switching between browser and app
This app solves these issues by providing:
- Native mobile experience with optimized UI/UX
- Seamless passkey authentication using WebAuthn standards
- Persistent session management across app launches
- Offline-capable content access through WebView integration
- React Native 0.79.6 - Cross-platform mobile development
- Expo SDK 52 - Development toolchain and deployment platform
- TypeScript - Type-safe JavaScript development
- expo-web-browser - Secure authentication sessions (ASWebAuthenticationSession on iOS, Chrome Custom Tabs on Android)
- expo-auth-session - OAuth 2.0 and OpenID Connect support
- WebAuthn/Passkey - Modern passwordless authentication
- React Native WebView - Embedded web content rendering
- React Native Paper - Material Design components
- React Hooks - Modern state management and lifecycle handling
- Metro Bundler - JavaScript bundling and hot reloading
- ESLint - Code linting and style enforcement
- Prettier - Code formatting
- Jest - Unit testing framework
- React Native + Expo: Rapid development with native performance and easy deployment
- TypeScript: Prevents runtime errors and improves developer experience
- WebAuthn/Passkey: Future-proof authentication that's more secure than passwords
- WebView Integration: Leverages existing Moodle web interface while providing native app benefits
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ Mobile App โ โ Moodle LMS โ โ WebAuthn โ
โ โ โ โ โ Provider โ
โ โโโโโโโโโโโโโโโ โ โ โโโโโโโโโโโโโโโโ โ โ โ
โ โ WebView โ โโโโโโค โ Login Page โ โ โ โ
โ โ Component โ โ โ โ โ โ โ โ
โ โโโโโโโโโโโโโโโ โ โ โโโโโโโโโโโโโโโโ โ โ โ
โ โโโโโโโโโโโโโโโ โ โ โโโโโโโโโโโโโโโโ โ โ โ
โ โ Deep Link โ โโโโโโค โ OAuth โ โโโโโโค โ
โ โ Handler โ โ โ โ Redirect โ โ โ โ
โ โโโโโโโโโโโโโโโ โ โ โโโโโโโโโโโโโโโโ โ โ โ
โ โโโโโโโโโโโโโโโ โ โ โโโโโโโโโโโโโโโโ โ โ โ
โ โ Auth โ โ โ โ Course โ โ โ โ
โ โ Manager โ โโโโโโค โ Content โ โ โ โ
โ โโโโโโโโโโโโโโโ โ โ โโโโโโโโโโโโโโโโ โ โ โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
- App Launch โ Auto-triggers authentication flow
- Browser Opens โ User completes passkey authentication
- OAuth Redirect โ Backend redirects to custom scheme
- Deep Link Handler โ Parses authentication parameters
- WebView Loads โ Authenticated Moodle content display
- Node.js 18+ and npm
- Expo CLI (
npm install -g @expo/cli) - iOS Simulator (for iOS development)
- Android Studio (for Android development)
# Clone the repository
git clone <repository-url>
cd MoodlePasskeyApp
# Install dependencies
npm install
# Install Expo CLI globally (if not already installed)
npm install -g @expo/cli-
Environment Setup
# Copy environment template cp .env.example .env # Edit configuration nano .env
-
Moodle Configuration
- Configure your Moodle instance to support OAuth redirects
- Add
myapp://callbackto allowed redirect URIs - Enable WebAuthn/Passkey authentication
-
App Configuration
// app.json { "expo": { "scheme": "myapp", "ios": { "bundleIdentifier": "com.yourcompany.moodlepasskey" }, "android": { "package": "com.yourcompany.moodlepasskey" } } }
# Start development server
npm start
# Run on iOS simulator
npm run ios
# Run on Android emulator
npm run android
# Run on physical device
# Scan QR code with Expo Go app// The app automatically handles the entire flow
// 1. App launches โ WebView loads Moodle
// 2. After 1 second โ Browser opens for authentication
// 3. User completes passkey login
// 4. App receives redirect and returns to WebViewimport { DeepLinkHandler } from './src/services/DeepLinkHandler';
const handler = DeepLinkHandler.getInstance();
handler.addListener((data) => {
if (data.oauthCode) {
console.log('Authentication successful:', data.oauthCode);
// Handle successful authentication
}
});# Test OAuth success flow
xcrun simctl openurl booted "myapp://callback?code=TEST123&state=state456"
# Test OAuth error flow
xcrun simctl openurl booted "myapp://callback?error=access_denied&error_description=User%20denied%20access"# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Run tests with coverage
npm run test:coverage# Test deep link handling
npm run test:integration
# Test authentication flow
npm run test:auth-
QR Code Testing
- Generate QR codes with test deep links
- Scan with device camera
- Verify app opens and parses parameters
-
Real Device Testing
- Deploy to physical device
- Test complete authentication flow
- Verify WebView content loads correctly
MoodlePasskeyApp/
โโโ src/ # Source code
โ โโโ components/ # React components
โ โ โโโ WebViewComponent.tsx # Main WebView wrapper
โ โ โโโ AuthStatusCard.tsx # Authentication status display
โ โโโ services/ # Business logic services
โ โ โโโ DeepLinkHandler.ts # Deep link parsing and handling
โ โ โโโ AuthManager.ts # Authentication state management
โ โ โโโ MoodleService.ts # Moodle API integration
โ โโโ utils/ # Utility functions
โ โ โโโ urlParser.ts # URL parsing utilities
โ โ โโโ logger.ts # Logging utilities
โ โโโ types/ # TypeScript type definitions
โ โ โโโ auth.ts # Authentication types
โ โ โโโ deepLink.ts # Deep link types
โ โโโ config/ # Configuration files
โ โโโ constants.ts # App constants
โ โโโ environment.ts # Environment configuration
โโโ docs/ # Documentation
โ โโโ architecture.md # Technical architecture
โ โโโ api.md # API documentation
โ โโโ deployment.md # Deployment guide
โโโ tests/ # Test files
โ โโโ unit/ # Unit tests
โ โโโ integration/ # Integration tests
โ โโโ __mocks__/ # Test mocks
โโโ .env.example # Environment variables template
โโโ .env # Environment variables (gitignored)
โโโ app.json # Expo configuration
โโโ package.json # Dependencies and scripts
โโโ README.md # This file
# .env
MOODLE_BASE_URL=https://moodle.hm.edu/
MOODLE_LOGIN_URL=https://moodle.hm.edu/login/index.php
REDIRECT_SCHEME=myapp
REDIRECT_PATH=auth
DEBUG_MODE=true
LOG_LEVEL=info{
"expo": {
"name": "Moodle Passkey App",
"slug": "moodle-passkey-app",
"version": "1.0.0",
"scheme": "myapp",
"ios": {
"bundleIdentifier": "com.yourcompany.moodlepasskey"
},
"android": {
"package": "com.yourcompany.moodlepasskey"
}
}
}# Create development build
expo build:ios --type development
expo build:android --type development# Create production build
expo build:ios --type production
expo build:android --type production# Submit to App Store
expo upload:ios
expo upload:android- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes with proper tests and documentation
- Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- TypeScript: All code must be properly typed
- ESLint: Follow the configured linting rules
- Prettier: Code must be formatted with Prettier
- Tests: New features must include unit tests
- Documentation: Update documentation for new features
type(scope): description
feat(auth): add passkey authentication support
fix(webview): resolve deep link parsing issue
docs(readme): update installation instructions
This project is licensed under the MIT License - see the LICENSE file for details.
-
Deep links not working
- Verify app scheme configuration
- Check redirect URI whitelist in Moodle
- Test with QR code generator
-
Authentication fails
- Verify Moodle supports WebAuthn
- Check network connectivity
- Review console logs for errors
-
WebView not loading
- Check Moodle URL accessibility
- Verify CORS settings
- Test in browser first
- Documentation: Check
/docsfolder for detailed guides - Issues: Open an issue on GitHub
- Discussions: Use GitHub Discussions for questions
- Email: Contact the development team
- Offline content caching
- Push notifications for course updates
- Dark mode support
- Multi-language support
- Advanced course filtering
- Grade book integration
- Native course content rendering
- Real-time collaboration features
- Advanced analytics dashboard
Built with โค๏ธ for seamless mobile learning experiences