Authentication¶
KMPShip includes built-in support for Firebase Authentication using Passage, allowing you to easily implement user authentication in your app.
Prerequisite: Create a Firebase Project¶
Note
You can skip this step if you already have a Firebase project set up.
Before configuring authentication, you must have a Firebase project already set up.
If you haven't done this yet, follow the linked guide and connect both your Android and iOS apps before continuing:
👉 Create a Firebase Project
Supported providers¶
KMPShip supports the following authentication providers out of the box:
None of these providers are mandatory — you can enable only the ones you need.
Google Sign In¶
- In the Firebase Console, go to Authentication > Sign-in method
- Enable Google as a provider.
- Copy the Web client ID provided by Firebase.
Android setup¶
Store the Web client ID in your local.properties
file like this:
This value will be injected automatically into your Android build.
iOS setup¶
- Open the
GoogleService-Info.plist
file downloaded from Firebase. -
Copy the values of the following keys:
CLIENT_ID
REVERSED_CLIENT_ID
-
Open your app’s
Info.plist
file and add the following keys:
<key>GIDClientID</key>
<string>YOUR_GOOGLE_SIGN_IN_WEB_CLIENT_ID</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>YOUR_REVERSED_GOOGLE_SIGN_IN_WEB_CLIENT_ID</string>
</array>
</dict>
</array>
Replace:
YOUR_GOOGLE_SIGN_IN_WEB_CLIENT_ID
with theCLIENT_ID
valueYOUR_REVERSED_GOOGLE_SIGN_IN_WEB_CLIENT_ID
with theREVERSED_CLIENT_ID
value
Apple Sign-In (iOS only)¶
To support Apple Sign-In in your app, you must:
- In the Firebase Console, go to Authentication > Sign-in method
- Enable Apple as a provider.
-
Configure Apple Sign-In for iOS:
-
Go to the Apple Developer Portal and:
- Create a Services ID
- Create a Key with Sign in with Apple enabled
- Link both to your app’s bundle identifier
-
In Firebase:
- Add your Services ID
- Upload the Key ID and Private Key
-
Set your Team ID (found in the Apple Developer Account settings)
-
In Xcode:
- Make sure the Sign In with Apple capability is enabled in your app’s target under Signing & Capabilities
- Confirm the app’s bundle identifier matches the one registered in the Apple Developer Portal
-
Email & Password¶
- In the Firebase Console, go to Authentication > Sign-in method
- Enable Email/Password as a provider.
Once enabled, KMPShip provides:
- A built-in Sign up and Sign in form for email/password users.
- Support for password reset: users can receive a password recovery email and reset their password directly in the app.
- Support for email verification: users can verify their email address after signing up.
- Firebase error handling for common issues (e.g., invalid credentials, user not found).
Authentication setup complete
You have successfully configured authentication in your KMPShip app. Users can now sign in using Google, Apple, or email/password methods.