Skip to content

Commit 7ab646e

Browse files
mbeernutGitchalWoo
andauthored
Add auth0 service and auth context
* Add Auth0 service and context * add constans variables for auth actions * add auth context to app * add storage service & fix token expiration read * remove id token * fix lint * fix lint warnirngs * fix error logging * refactor AuthContext * move fn outside useeffect * fix warnings * always read expires at from jwt directly * remove custom revoke * remove accessToken from storage * remane context folder * Add tests for auth and storage * cleanup * fix import * fix minor naming & tests * remove expo go from docs --------- Co-authored-by: Michał Walczak <97791891+GitchalWoo@users.noreply.github.com>
1 parent 17ad3ad commit 7ab646e

File tree

14 files changed

+1058
-56
lines changed

14 files changed

+1058
-56
lines changed

CLAUDE.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,6 @@ These must match Auth0 dashboard configuration.
467467
## Important Notes
468468

469469
1. **New Architecture Enabled**: React 19 with New Architecture (`newArchEnabled: true` in `app.json`)
470-
2. **Biometrics in Expo Go**: Disabled during Expo Go development, enabled in production builds
471470
3. **Zscaler Users**: Ensure Zscaler policies are up-to-date for corporate environments
472471
4. **Node Version**: Use Node.js LTS (20.19.4+)
473472
5. **Android Emulator**: Must be running before `npm run android`

README.md

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ A comprehensive React Native mobile application built with Expo, featuring Auth0
1717
**iOS 17 & iOS 18**: Fully supported
1818
**Android 14 & Android 15**: Fully supported
1919

20-
> **Note**: Some features (like biometrics) are disabled in Expo Go during development but work properly in production builds.
21-
2220
## Key Features
2321

2422
- **Auth0 Authentication**: OAuth2/OIDC with OTP verification
@@ -54,14 +52,9 @@ A comprehensive React Native mobile application built with Expo, featuring Auth0
5452

5553
3. **Start Development**
5654
```bash
57-
npx expo start --clear
55+
npx expo run:ios
56+
npx expo run:android
5857
```
59-
60-
Then:
61-
- **iOS**: Press `i` or scan QR code with Camera app
62-
- **Android**: Press `a` or scan QR code with Expo Go app
63-
- Press `r` to reload the app when needed
64-
- Click `Ctrl+C` to shut down the server
6558

6659
### Android Emulator Setup (if needed)
6760

@@ -121,10 +114,6 @@ Please ask team members to share specifics
121114

122115
**Callback URLs:**
123116
```
124-
# Development (Expo Go)
125-
exp://[YOUR-IP]:8081/--/auth0
126-
exp://localhost:8081/--/auth0
127-
128117
# Production
129118
softwareone.playground-platform-navigation://login-dev.pyracloud.com/ios/com.softwareone.marketplaceMobile/callback
130119
softwareone.playground-platform-navigation://login-dev.pyracloud.com/android/com.softwareone.marketplaceMobile/callback
@@ -210,12 +199,6 @@ npx expo run:ios
210199

211200
# Android
212201
npx expo run:android
213-
214-
# Expo Go (Quick Development)
215-
npx expo start
216-
217-
# Clear Cache
218-
npx expo start --clear
219202
```
220203

221204
## Local Build - iOS

app/App.tsx

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
1+
import React from 'react';
12
import { StatusBar } from 'expo-status-bar';
23
import { StyleSheet, Text, View } from 'react-native';
4+
import { AuthProvider } from '@/context/AuthContext';
35
import { isFeatureEnabled } from '@featureFlags';
46
import { Colors } from './src/constants/colors';
57

8+
const App = () => {
9+
const featureTestEnabled = isFeatureEnabled('FEATURE_TEST');
10+
11+
return (
12+
<AuthProvider>
13+
<View style={styles.container}>
14+
<Text>
15+
{featureTestEnabled ? 'Test Feature Enabled' : 'Test Feature Disabled'}
16+
</Text>
17+
<StatusBar style="auto" />
18+
</View>
19+
</AuthProvider>
20+
);
21+
};
22+
623
const styles = StyleSheet.create({
724
container: {
825
flex: 1,
@@ -12,17 +29,4 @@ const styles = StyleSheet.create({
1229
},
1330
});
1431

15-
const App = () => {
16-
const featureTestEnabled = isFeatureEnabled('FEATURE_TEST');
17-
18-
return (
19-
<View style={styles.container}>
20-
<Text>
21-
{featureTestEnabled ? 'Test Feature Enabled' : 'Test Feature Disabled'}
22-
</Text>
23-
<StatusBar style="auto" />
24-
</View>
25-
);
26-
}
27-
2832
export default App;

app/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,4 @@ import { registerRootComponent } from 'expo';
22

33
import App from './App';
44

5-
// registerRootComponent calls AppRegistry.registerComponent('main', () => App);
6-
// It also ensures that whether you load the app in Expo Go or in a native build,
7-
// the environment is set up appropriately
85
registerRootComponent(App);

app/jest.config.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
1-
export default {
1+
module.exports = {
22
preset: 'ts-jest',
33
testEnvironment: 'node',
4-
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
5-
testMatch: ['**/__tests__/**/*.test.(ts|tsx|js)'],
6-
coverageReporters: ['text', 'lcov', 'json-summary'],
4+
setupFilesAfterEnv: ['<rootDir>/src/__tests__/setup.ts'],
5+
moduleFileExtensions: ['ts', 'tsx', 'js'],
6+
testMatch: [
7+
'**/__tests__/**/*.test.(ts|tsx|js)',
8+
],
9+
moduleNameMapper: {
10+
'^@/(.*)$': '<rootDir>/src/$1',
11+
},
12+
transformIgnorePatterns: [
13+
'node_modules/(?!(expo-secure-store|@react-native-async-storage|react-native-auth0)/)',
14+
],
715
collectCoverageFrom: [
816
'src/**/*.{ts,tsx}',
917
'!src/**/*.d.ts',

0 commit comments

Comments
 (0)