@onairosofficial/onairos-capacitor 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/OnairosofficialOnairosCapacitor.podspec +1 -1
- package/README.md +17 -6
- package/dist/onairos.capacitor.esm.js +1 -1
- package/dist/onairos.capacitor.esm.turbopack.js +1 -1
- package/onairos.d.ts +16 -26
- package/package.json +1 -1
- package/src/capacitorOAuthConfig.js +24 -13
- package/src/components/EmailAuth.js +3 -1
- package/src/components/EmailAuth.jsx +3 -1
package/README.md
CHANGED
|
@@ -106,20 +106,32 @@ This is what brings users back from OAuth connectors like YouTube, TikTok, Pinte
|
|
|
106
106
|
|
|
107
107
|
## Google Sign-In
|
|
108
108
|
|
|
109
|
-
Capacitor
|
|
109
|
+
A packaged Capacitor project is a native mobile app for Google OAuth. It does not need to be listed in the App Store or Google Play, but the developer must create native OAuth credentials for the app's identity:
|
|
110
|
+
|
|
111
|
+
- iOS: create an **iOS** OAuth client using the exact bundle ID from `capacitor.config.*` (`appId`).
|
|
112
|
+
- Android: create an **Android** OAuth client using the same package name plus the SHA-1 fingerprint of the debug or release signing certificate.
|
|
113
|
+
|
|
114
|
+
The developer passes only those native client IDs to the SDK:
|
|
110
115
|
|
|
111
116
|
```jsx
|
|
112
117
|
import { updateGoogleClientIds } from '@onairosofficial/onairos-capacitor';
|
|
113
118
|
|
|
114
119
|
updateGoogleClientIds({
|
|
115
|
-
webClientId: import.meta.env.VITE_ONAIROS_GOOGLE_WEB_CLIENT_ID,
|
|
116
120
|
iosClientId: import.meta.env.VITE_ONAIROS_GOOGLE_IOS_CLIENT_ID,
|
|
117
121
|
androidClientId: import.meta.env.VITE_ONAIROS_GOOGLE_ANDROID_CLIENT_ID,
|
|
118
|
-
serverClientId: import.meta.env.VITE_ONAIROS_GOOGLE_WEB_CLIENT_ID,
|
|
119
122
|
});
|
|
120
123
|
```
|
|
121
124
|
|
|
122
|
-
|
|
125
|
+
Do not set `webClientId` or `serverClientId` to an iOS or Android client ID. Since `0.1.3`, the SDK owns those values and defaults both to the Onairos web OAuth client that the backend verifies. The native client identifies the installed app; the web/server client is the ID token's `aud` value. Mixing them causes `Google token audience mismatch`.
|
|
126
|
+
|
|
127
|
+
### Google Cloud setup
|
|
128
|
+
|
|
129
|
+
1. Configure the OAuth consent screen in the Google Cloud project used for the native app.
|
|
130
|
+
2. For iOS, create an iOS OAuth client using the exact `appId`/bundle ID. Add Google's reversed iOS client ID as a URL scheme in `ios/App/App/Info.plist`, then run `npx cap sync ios`.
|
|
131
|
+
3. For Android, create an Android OAuth client using the exact `appId`/package name and signing SHA-1. Use `cd android && ./gradlew signingReport` (or `.\gradlew signingReport` on Windows) to obtain the debug SHA-1, and create a separate credential for the production signing key. Add the Google-generated native configuration required by `@capgo/capacitor-social-login`, then run `npx cap sync android`.
|
|
132
|
+
4. Keep native client IDs in environment configuration. They are OAuth identifiers rather than client secrets, but environment configuration prevents accidental cross-app reuse.
|
|
133
|
+
|
|
134
|
+
The app does not need to be published in either store for these credentials to work in local development, TestFlight, or internal testing.
|
|
123
135
|
|
|
124
136
|
## Basic Usage
|
|
125
137
|
|
|
@@ -169,7 +181,7 @@ npm run test:package
|
|
|
169
181
|
npm publish
|
|
170
182
|
```
|
|
171
183
|
|
|
172
|
-
The package is currently prepared as `0.1.
|
|
184
|
+
The package is currently prepared as `0.1.3`.
|
|
173
185
|
|
|
174
186
|
## Local Test App
|
|
175
187
|
|
|
@@ -187,7 +199,6 @@ For local development, create `test-app/.env.local` with:
|
|
|
187
199
|
|
|
188
200
|
```bash
|
|
189
201
|
VITE_ONAIROS_API_KEY=...
|
|
190
|
-
VITE_ONAIROS_GOOGLE_WEB_CLIENT_ID=...
|
|
191
202
|
VITE_ONAIROS_GOOGLE_IOS_CLIENT_ID=...
|
|
192
203
|
VITE_ONAIROS_GOOGLE_ANDROID_CLIENT_ID=...
|
|
193
204
|
```
|