react-native-nitro-auth 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,26 +1,34 @@
1
1
  # react-native-nitro-auth
2
2
 
3
- 🔐 **The fastest authentication library for React Native** — Google & Apple Sign-In with native C++/JSI performance. No bridge overhead. Full feature parity across iOS, Android, and Web.
3
+ 🚀 **High-performance, JSI-powered Authentication for React Native.**
4
4
 
5
- [![npm](https://img.shields.io/npm/v/react-native-nitro-auth)](https://www.npmjs.com/package/react-native-nitro-auth)
6
- [![license](https://img.shields.io/npm/l/react-native-nitro-auth)](LICENSE)
5
+ Nitro Auth is a modern authentication library for React Native built on top of [Nitro Modules](https://github.com/mrousavy/nitro). It provides a unified, type-safe API for Google and Apple Sign-In with zero-bridge overhead.
7
6
 
8
- ## Why react-native-nitro-auth?
7
+ ## Why Nitro Auth?
9
8
 
10
- - **Zero bridge overhead** Built on [Nitro Modules](https://github.com/mrousavy/nitro) (C++/JSI), authentication calls are synchronous where possible
11
- - 🔐 **Google & Apple Sign-In** — Production-ready implementation for iOS, Android, and Web
12
- - 📦 **Session persistence** Users stay logged in across app restarts automatically
13
- - 🎯 **Custom OAuth scopes** Request only the permissions you need
14
- - 🔄 **Incremental authorization** Add scopes later without re-authentication
15
- - 🔑 **Predictable Error Handling** Standardized error codes across all platforms
16
- - 🔁 **Automatic Token Refresh** Seamlessly handles background token rotation
17
- - 🎨 **Ready-to-use UI** Pre-built `SocialButton` with loading states
18
- - 📱 **Expo & bare RN** — Works with both, config plugin included
9
+ Nitro Auth is designed to replace legacy modules like `@react-native-google-signin/google-signin` with a modern, high-performance architecture.
10
+
11
+ | Feature | Legacy Modules | Nitro Auth |
12
+ | :--- | :--- | :--- |
13
+ | **Performance** | Async bridge overhead (JSON) | **Direct JSI C++ (Zero-copy)** |
14
+ | **Persistence** | Varies / Manual | **Built-in & Automatic** |
15
+ | **Setup** | Manual async initialization | **Sync & declarative plugins** |
16
+ | **Types** | Manual / Brittle | **Fully Generated (Nitrogen)** |
17
+
18
+ ## Features
19
+
20
+ - 🏎️ **Ultra-fast**: Direct C++ calls using JSI (no JSON serialization).
21
+ - 🛡️ **Fully Type-Safe**: Shared types between TypeScript, C++, Swift, and Kotlin.
22
+ - �� **Incremental Auth**: Request additional OAuth scopes on the fly.
23
+ - 📦 **Expo Ready**: Comes with a powerful Config Plugin for zero-config setup.
24
+ - 📱 **Cross-Platform**: Unified API for iOS, Android, and Web.
25
+ - 🔁 **Auto-Refresh**: Synchronous access to tokens with automatic silent refresh.
19
26
 
20
27
  ## Installation
21
28
 
22
29
  ```bash
23
- npm install react-native-nitro-auth react-native-nitro-modules
30
+ bun add react-native-nitro-auth react-native-nitro-modules
31
+ bun prebuild
24
32
  ```
25
33
 
26
34
  ### Expo Setup
@@ -36,6 +44,7 @@ Add the plugin to `app.json`:
36
44
  {
37
45
  "ios": {
38
46
  "googleClientId": "YOUR_IOS_CLIENT_ID.apps.googleusercontent.com",
47
+ "googleServerClientId": "YOUR_WEB_CLIENT_ID.apps.googleusercontent.com",
39
48
  "googleUrlScheme": "com.googleusercontent.apps.YOUR_IOS_CLIENT_ID"
40
49
  },
41
50
  "android": {
@@ -43,24 +52,17 @@ Add the plugin to `app.json`:
43
52
  }
44
53
  }
45
54
  ]
46
- ],
47
- "extra": {
48
- "googleWebClientId": "YOUR_WEB_CLIENT_ID.apps.googleusercontent.com",
49
- "appleWebClientId": "com.yourcompany.yourapp.service"
50
- }
55
+ ]
51
56
  }
52
57
  }
53
58
  ```
54
59
 
55
- Then run:
56
-
57
- ```bash
58
- npx expo prebuild
59
- ```
60
+ > [!NOTE]
61
+ > `googleServerClientId` is only required if you need a `serverAuthCode` for backend integration.
60
62
 
61
63
  ### Bare React Native
62
64
 
63
- **iOS:** Add `GIDClientID` to `Info.plist` and enable "Sign in with Apple" capability.
65
+ **iOS:** Add `GIDClientID` (and optionally `GIDServerClientID`) to `Info.plist` and enable "Sign in with Apple" capability.
64
66
 
65
67
  **Android:** Add `nitro_auth_google_client_id` string resource in `res/values/strings.xml`.
66
68
 
@@ -220,31 +222,6 @@ if (user?.serverAuthCode) {
220
222
  | Auto-Refresh | ✅ | ✅ | ✅ |
221
223
  | Native C++ Performance | ✅ | ✅ | — |
222
224
 
223
- ## Troubleshooting
224
-
225
- ### Common Issues
226
-
227
- - **`configuration_error`**: This usually means the `googleClientId` or `GIDClientID` is missing from your native configuration. Double-check your `app.json` or `Info.plist`/`strings.xml`.
228
- - **`cancelled`**: The user manually closed the sign-in modal. This is expected behavior and should be handled by your UI.
229
- - **Android Popup not appearing**: Ensure you have configured the correct SHA-1 fingerprint in the Google Cloud Console for your Android app.
230
- - **Web Popup blocked**: Browsers may block popups if they aren't triggered by a user gesture. Ensure `login()` is called directly from an `onPress` or `onClick` handler.
231
-
232
- ### Checking Setup Status
233
-
234
- On Android, you can use `hasPlayServices` to check if the device supports Google Sign-In before showing the button.
235
-
236
- ## Testing & Example App
237
-
238
- The monorepo includes a full-featured example app in `apps/example`.
239
-
240
- ### Running the Example
241
-
242
- 1. **Install dependencies**: `bun install`
243
- 2. **Configure Client IDs**: Update `apps/example/app.json` with your Google/Apple credentials.
244
- 3. **Run on iOS**: `npm run example:ios`
245
- 4. **Run on Android**: `npm run example:android`
246
- 5. **Run on Web**: `npm run start -- --web`
247
-
248
225
  ## Architecture
249
226
 
250
227
  `react-native-nitro-auth` is built using [Nitro Modules](https://github.com/mrousavy/nitro). Unlike traditional React Native modules, Nitro uses JSI to provide:
@@ -63,6 +63,7 @@ android {
63
63
 
64
64
  buildFeatures {
65
65
  buildConfig true
66
+ consumerProguardFiles "proguard-rules.pro"
66
67
  prefab true
67
68
  }
68
69
 
@@ -0,0 +1,4 @@
1
+ # Nitro Auth Proguard Rules
2
+ -keep class com.auth.** { *; }
3
+ -keep class com.margelo.nitro.com.auth.** { *; }
4
+ -keep class com.google.android.gms.auth.api.signin.** { *; }
package/app.plugin.js CHANGED
@@ -63,5 +63,5 @@ const withNitroAuth = (config, props = {}) => {
63
63
  module.exports = createRunOncePlugin(
64
64
  withNitroAuth,
65
65
  "react-native-nitro-auth",
66
- "0.1.2"
66
+ "0.1.3"
67
67
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-nitro-auth",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "High-performance authentication library for React Native with Google Sign-In and Apple Sign-In support, powered by Nitro Modules (JSI)",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",